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.

very technical question about eeprom writing?

Status
Not open for further replies.

d@nny

Full Member level 5
Joined
May 28, 2011
Messages
246
Helped
11
Reputation
22
Reaction score
11
Trophy points
1,298
Activity points
3,238
i want to write 8 eeprom locations let says 0h to 08h .
i set the adressess eeadr and data eedata for all these 8 locations and enable writing.
or i need to write thsese locaitons one by one let says first write first location than given data and write second location.
IF all these location can be write with one wright command than what happens if

the writing is start and during the writing the power to pic eeprom fails.
what happens to the eeprom
is the eeprom crash
let says 4 of 8 locations had been write when power fails
is the 4 locations still save or the old eeprom data were there on these locations when repower the pic
thanking you in anticipation
 

You should generally assume, that the involved memory locations can be corrupted, contain unpredictable data. If you want to take care of similar situations, you 'll need a backup copy of the original data. Or preferably, design the power supply with a power failure signal and a suitable storage capacitor for reliable operation in case of power failure.
 

can u plz provide me some perfect diagramme or info for power failure signal diagramme? how much time is required to write 8 locations of eeprom while on 8mhz ???? i am using pic mcu
 

The EEPROM timing is given in the datasheet. In tells about a typical write cycle of 4 ms. This sounds a lot for a single byte, but no additional information is given.

For the power fail detection, I can give you the baisc idea. You'll monitor the DC voltage before the voltage regulator. If it drops under a specific threshold, you generate a power fail signal, may be a hardware interrupt or just a signal that's checked in the EEPROM byte write function. The power supply filter capacitor has been dimensioned suchm, that after th epower fail is asserted yoi'll have sufficient time either to fnish the pending EEPROM byte write or to write all required nonvoltatile data.
 

Another method you could try, is to use a location in eeprom that is updated after each succesful location write. if the code fails to complete all 8 writes, when the pic is restarted this location could be checked for it contents. If it is not what you would expect after 8 writes, you know that you would need to start the process again from location 1.
 

The power failure signal might be a simple voltage divider on the main power capacitor.
The idea of this simple detector is to trigger the MCU when the voltage on this capacitor is at the minimum permissible value.
Perhaps one may like to add an npn transistor to increase the signal slope (at the MCU pin) in the detection range.

Another method is detecting the missing of the first half cycle from mains.
In special applications, one may use both methods and the MCU is triggered for power failure by either of the two.

I think in your case the first one is enough.

Now let us see what comes next, I mean in the interrupt routine.
The first thing to do is to change the MCU ports state so that the circuit current becomes minimal. This helps slowing the power capacitor discharge hence getting more time to continue the memory writing.

I am afraid that the design details depend on many factors related to your actual board which are unknown.

Personal:
About 17 years ago, I faced this problem when I designed my first sat dish positioner. I had Z80 and EPROM only (like 27C512) for its instructions. Obviously every time the set was turned off, its final status had to be saved (about 3 bytes if I remember well). So I built in each set an EPROM programmer (parallel type at that time) which should work just after the mains is cut (usually by the user). I sold about 400 sets before updating it by using EEPROM then SEEP (as 24C16).
To FvM... yes, after about 20,000 cuts the EPROM would become full hence useless :grin: this could happen after 10 years with an average of 5 cuts/day. That is why no user complained :wink:

Kerim
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top