Thursday, May 6, 2010

Tasks 51 - 53

51) Check out the eeprom read program at http://arduino.cc/en/Reference/EEPROMRead
Get it running and put a screen dump into your blog. They may be all $FFs or all $00's at first.

Note: EEPROM.write(address, value);
#include EEPROM.h

int a = 0;
int value;

void setup()
{
Serial.begin(9600);
}

void loop()
{
value = EEPROM.read(a);

Serial.print(a);
Serial.print("\t");
Serial.print(value);
Serial.println();

a = a + 1;

if (a == 512)
a = 0;

delay(500);
}


My first attempt printed this out to the serial monitor:


However after I ran the eeprom write program and went back to try the read program again it printed out this instead:
This was because it had reset the values through the for loop.

52) Now run the similar eeprom write program to send $23 to address 01 and $2A to address 02. Add a eeprom dump, all 512 bytes, function to your program based on the eeprom read program above so you can see that your bytes have been changed.

//Notes:
EEPROM.write(address, value);
#include EEPROM.h

void setup()
{
//for (int i = 0; i less than 512; i++)
// EEPROM.write(i, i);

instead of the above for loop:
EEPROM.write(01, 23);
EEPROM.write(02, 24);

This will write the values 23 and 24 to the address of 01 and 02.

}

void loop()
{
}



53) Fill the total eeprom with $AB's all 1024 bytes. Read eeprom space back onto your screen and do a screen capture picture for your blog.

1 comment:

  1. Hi Lisa

    Your blog up to the 50 mark looks good to me. Nice layout and comments.

    Regards
    PeterB

    ReplyDelete