PDA

View Full Version : save data in pic



PoTeToJB
- 11th May 2006, 16:47
hello..

i use pic16f84a for count something.. but if power supply off the data is lost.
how can i save the data in pic and if i on the supply back the data will be use.
can some one help me.

Archilochus
- 11th May 2006, 18:04
Save the data to the on-board EEPROM - I think the F84 has 64 bytes.

paul borgmeier
- 11th May 2006, 18:17
MELabs has sample code to do what Archilochus suggest here
http://www.melabs.com/resources/samples/pbp/eeword.bas
also check the samples file in your PBP folder for another example (ee.bas)

Paul Borgmeier
Salt Lake City, Utah
USA

PoTeToJB
- 11th May 2006, 18:23
thankQ.

i try this tonight

and how can i give signal for write data to eeprom before power supply off.

i cant save the data every time because my system loop forever

docwisdom
- 11th May 2006, 20:23
there is a code example post by Melanie that addresses this as far as I remember. Do a quick search, youll find it.

PoTeToJB
- 14th May 2006, 17:19
thankQ

now i know how to read and write data to pic.

i have anathor question.

can i use interrupt and write progran to save data in pic..

i try use interrupt and write program to write data to pic. but cant function..

why..

or i cant use write program if i use interrupt

mister_e
- 15th May 2006, 03:37
I can't believe it's impossible.. just post your code here first!

ErnieM
- 17th May 2006, 21:17
and how can i give signal for write data to eeprom before power supply off.


Well... keep a copy of the data in a register, and compare your new value in the loop to the existing register value.

When and only when you have a new value, send the new value to the EEPROM, and update your register value too. Don't do it too often, as there is a limited number of cycles on that memory.