Go to Post ...some of our robots could use a proctologist - Scott Ritchie [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 12-09-2004, 22:28
Rickertsen2 Rickertsen2 is offline
Umm Errr...
None #1139 (Chamblee Gear Grinders)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2002
Location: ATL
Posts: 1,421
Rickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant future
Send a message via AIM to Rickertsen2 Send a message via Yahoo to Rickertsen2
Re: Saving a variable in between runs.

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.
__________________
1139 Alumni

Last edited by Rickertsen2 : 12-09-2004 at 22:35.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MPLAB Variable Simulator? Chris_Elston Programming 3 18-02-2004 12:08
Interrupt Handlers and Variable Scope kaszeta Programming 2 14-02-2004 18:30
variable? manodrum Programming 11 01-04-2003 17:20
Dashboard programs and the char variable Ian W. Programming 13 26-06-2002 02:07
what teams have a variable transmissions? Greg Perkins Technical Discussion 4 06-03-2002 06:10


All times are GMT -5. The time now is 21:46.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi