Thread: new to EEPROM
View Single Post
  #3   Spotlight this post!  
Unread 22-05-2007, 12:51
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: new to EEPROM

As everyone else has said, you have 1024 bytes of EEPROM. What they haven't said is how to use it...

When you have Kevin Watson's EEPROM code installed, you call EEPROM_Write() with the address you want to write to (this needs to be between 0 and 1023, inclusive) and the value you want to write. Later on, call EEPROM_Read() with the address you wrote to, and it will return the value saved in EEPROM.

If you call EEPROM_Write(0,1); (which writes 1 to the first byte, byte 0, in EEPROM) then call EEPROM_Read(0); it will return 1. This lasts even if the controller loses power--if you called EEPROM_Write(x,y), and that's the last byte you wrote to that address in EEPROM, EEPROM_Read(x) will always return y.

The controller doesn't care where you save data in the EEPROM; it is entirely up to you. I suggest making a quick spreadsheet listing which address is what.

The best part about EEPROM is that all of it is at your disposal. The default code does not touch EEPROM at all. You can use every byte, 0 to 1023, for whatever you want. You could even make it a 1KB flash drive, if you want (but I'm not sure if you could find a good enough MP3 encoder to get your music compressed that small... ).

If you need specific code, I can probably supply it, but you learn best when you figure it out yourself--try it!

Happy coding
JBot

EDIT: If you want a menu-driven system, you will need to build it yourself. Check into some more of Kevin's code--there is an example of a terminal in Kevin's "Bells and Whistles" camera code. You will need his serial driver (no point in writing that yourself...it's a lot of gross low-level garbage) at the very least.

Again, I'll help you with the specifics if you really can't figure it out, but I'd like you to take the plunge yourself.
__________________
Aren't signatures a bit outdated?

Last edited by JBotAlan : 22-05-2007 at 13:05. Reason: More info