Arduino UNO ve MEGA kullanırken Seri Bağlantı kullanarak EEPROM a sadece 63 karakter gönderebiliyorum. EEPROM 0 ile EEPROM 62 aralığına yazıyor. Daha fazlasını yazmamasının nedeni ne olabilir?
post your code
if(Serial.available()>0)
{
for (int i = 0; i < 93; i++) {
char veri=Serial.read();
EEPROM.write(i, veri);
}
ESP32 and ESP8266 no problem.
where is the code that verifies the writes and possibly displays them?
This is not enough, please post all of your code, a minimum runnable example of the issue.
What that does:
if one byte is available, read 93 bytes and write to EEPROM. So if you e.g. send the character 'a' as the first byte, it will write 'a' in the first EEPROM cell and 92 times -1(0xFF).
Further the serial buffer in the arduino is limited to 64 (might be 63, not sure) bytes; if you send more without reading it in time, a buffer overflow will occur. Please have a look at Robin's Serial Input Basics - updated how to reliably read data; if you want to receive more than 32 bytes, you have to adjust const byte numChars = 32;.
Note:
Please post in English; use google translate if needed.
Only 63 of the 92-character data that I send over the serial port (with the Windows form application) appear on the serial screen. EEPROM(0)..............EEPROM(62)
#include <Arduino.h>
#include <EEPROM.h>
#define EEPROM_SIZE 512
void setup() {
Serial.begin(9600);
EEPROM.begin();
}
void loop() {
if(Serial.available()>0)
{
for (int i = 0; i < 93; i++) {
char veri2=Serial.read();
EEPROM.update(i, veri2);
}
}
delay(1500);
for (int i = 0; i < 93; i++) {
Serial.print(i);
Serial.print("-");
Serial.println(EEPROM.read(i));
}
delay(15000);
}
The problem seems to be a buffer issue. But I don't quite understand how to solve it.
See the link in post #7.
I solved the problem. Thank you to everyone who replied. I solved it by modifying the Software Serial library.
I found the solution by changing the statement that says "#define _SS_MAX_RX_BUFF 64 // RX buffer size" as follows.
#define _SS_MAX_RX_BUFF 128 // RX buffer size
thanks to you
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.