for some reason my code ends exactly 1 bit too soon,
byte Value;
void setup() {
DDRA = 0xFF;
DDRC = 0xFF;
DDRL = 0x00;
Serial.begin(19200);
pinMode(2, INPUT);
}
void loop() {
while (digitalRead(2) == LOW) {}
for (word i = 0x0; i != 0xFFFF; i++) {
PORTA = lowByte(i);
PORTC = highByte(i);
Value = PINL;
delayMicroseconds(2);
if (Value < 0x10 ) {
Serial.print(0);
}
Serial.println(Value, HEX);
delayMicroseconds(2);
}
exit(0);
}
this is to read out EPROMs, it goes from Address $0000 to $FFFE, even tho i stated in the loop it is only supposed to end when it reaches $FFFF, i tried to use an "if" statement plus a "goto", also tried "while" statement. all of those loops ended 1 bit too early.
and when i try to display the current number by rewriting the Serial.println to display "i" it stops way too early. the Serial monitor looks something like this near the end:
FFEC
FFED
FFEE
FFEF
FFF0
FFF1
FFF2
FFF3
FFF
then it just ends. the LEDs on my breadboard show FFFE, but the monitor only FFF- (cut off). btw each of the other types of loops had the same Serial Monitor result.
A:
<some code>
++x;
if (x = <whatever>) {
goto B
}
goto A
B:
exit(0);
while (x != <whatever>){
<some code>
++x;
}
exit(0);
say is there any way to read data from an external File (.TXT or .BIN or something) and then use whatever is in the file and load that into the EPROM/EEPROM?
something like using the file as an Array to draw Bytes from.
is there any way to read data from an external File
You can read data from a file on an SD card if you have the right hardware or you could send it over the Serial link from the PC but you will need software to send the file from the PC and a sketch on the Arduino to read it and save it.
1Proxy0:
can i not just skip the SD card and directly read from the PC and use that?
otherwise i would need to buy something that can hold an SD card, and also somehow put raw binary data onto it.
The Arduino isn't part of the PC so it can't read the hard drive on it or anything.
You could write code to go on the PC to read a file and send the data to Arduino over serial and then write code on the Arduino to read from the serial line and do whatever with it.
// increment word from zero to zero
void setup() {
Serial.begin(230400);
unsigned long counter = 0;
word i = 0;
do {
counter += 1;
i += 1;
} while (i != 0);
Serial.print("counter incremented ");
Serial.print(counter);
Serial.print(" times");
}
void loop() {
// put your main code here, to run repeatedly:
}
To send a file from the PC you need something different to the Arduino Serial Monitor. RealTerm or a hundred other terminal programs will allow you to select a file and blurt it out to Serial.