Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC 18F nonvolatile memory

Status
Not open for further replies.

ernestmyname

Member level 1
Joined
Nov 19, 2009
Messages
33
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Clemson
Activity points
1,548
I wish to give my pic 18F the capability to store A/D values and retain those values even if the power is lost or the unit is reset.

The values will be stored only if 'program mode' is activated by I/O. So theoretically, these values will only be set by software once and then used for the rest of the micro controller's life.

The problem I've run into is that according to the datasheet, memory is stored in nonvolatile memory by the EEDATA and EEADR registers. If I store my values using this method, how will I know on the next powerup which registers my values are stored at?

In short, if I save values using EEDATA and EEADR, how will I be able to access them after powerdown?
 

This is what EEPROM data memory is meant for, to restore data even after power down. Have a look at the uC datasheet how to use them.

Depending on much data you want to store, you can also consider using external serial EEPROM 24LCXXX.

Hope this helps
 

If I store my values using this method, how will I know on the next powerup which registers my values are stored at?
Any problem to use well defined addresses for the individual data?
 

My goal here is to use resources already found on the chip. This is my controller:

https://ww1.microchip.com/downloads/en/DeviceDoc/39632b.pdf

The only non-volatile resource I see listed is the EEPROM on page 91. A search for 'nonvolatile' will bring you to this page. It gives instructions of how to write to the memory but doesn't give you instructions on how to get back to those locations after power-down.
 

Hm. The PIC EEPROM can be written and read. The method is described clearly in the datasheet. You may want
to read it once more, particularly 7.2 Reading ...
 

I don't think you understand what I'm asking.

I know how to write to the EEPROM. When you write data to the EEPROM, it gives you the address where the data was stored.

On power up, how do I know what address the data was previously stored at? I could store the address in the EEPROM but if I store the address in the EEPROM how am I going to know the address of the address of the data on next powerup?
 

I understand now - I am assuming that the EEPROM address go from 0x00 to 0xFF. Is this correct?
 

This is correct for a 18F with 256 bytes EEPROM memory.

In **broken link removed**, it is explained how you can read and write the EEPROM memory of your 18F with some simple read and write functions.
 

friend

why don't you just use a byte of EEPROM to check whether any previous data is been written to the EEPROM?
this you should do at the startup
if the data is stored, then reload the same. otherwise, do the normal process
i could not find any difficulties

regards


ml
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top