There are 2 ways to store data permanently:
1.)Flash memory(AKA: program memory)
2.)EEPROM memory
The first is ridiculously complicated and i'm not going to bother to explain it. EEPROM is relatively simple. EEPROM Is a special 1kilobyte region of memory. It cannot be read or written to through conventional methods. There are special procedures for this (detailed in the PIC datasheet). It must be read/written to one byte at a time. You will need to either devise your own file system to keep track of where you put things or be very careful not to put things in the same place. We have written both a library which has basic read buffer/write buffer functions as well as a basic file system. Neither has been been tested yet but their testing is on our agenda of thigns to do this week. Once we are sure they work i would be more than happy to post the code for the basic read/write. I won't post the file system because its rather specific to our robot, but if you need any help I will be more than happy to give it.
The best resources i have found about writing to the EEPROM are the PIC18F8520 datasheet (available from the microchip website. It assumes you are programming in assembly but still VERY helpful) and the following thread:
http://www.chiefdelphi.com/forums/sh...d.php?t=22655&
One thing worth mentioning:
*EEPROM can be read from instantaneously but writing takes time.... Enough time that the robot can easily time out if you try to write too much data at a time. The good thing is that this writing can be handled in the background. You can initiate a write and set up an interrupt to be called when writing is finished.
You know what... screw it.. I will post my untested code. I can't guarentee it works( and it probably doesn't), but i will release a version that does soon.
It can be found here:
http://geargrinders.pictar.net/EEPROM.zip
I will explain the basics of how to use it:
*during your initialization or sometime before using my EEPROM library, you
must call EEInit.
*add the following to the end of the function InterruptHandlerLow () in user_routines_fast.c:
HandleEEPROMInterrupts();
*include EEPROM.h in any files that use the EEPROM library.
Other than that, I think the methods are pretty self explanatory. If not just let me know and i will explain them. Look in EEPROM.h for a list of them.