Writing to EEPROM

hi, I need help in writing data to Eeprom. I also want to know that can i use the interrupt of Brown out detect(BOF register) to write the data to EEprom? Are there any sample codes?

Thanks and regards, Nick

Reply to
Nick
Loading thread data ...

The only way to be completely safe is to use a meat thermometer. The browning indicator is unreliable as browning may relate to peak temperature and not to core temperature.

Seriously Nick,

You haven't given a clue as to the chips you're working with, how long you might have after brown-out and before the lights go out, how big your EEP is.

Try a more specific question. Even better, try a more apt newsgroup such as : picforum or 6805-newbie.

PN2222A

Reply to
PN2222A

Hi,

I am programming 89LPC932 in assembly using Keil uVision V2.40a. My application is countng 500hrs and giving a output high for 10 seconds. I am using timer0 for generating 1 second, and i am counting 500hrs -

167740. For this i am using r0 to give increment after 40h, and a timer1(counter) for giving overflow tr1 at 1677h. I am using timer0 again to give 10 seconds output hold. I want HELP to program EEProm to store data(ro and Timer1) in the event of powr fail using Brown out detect BOF flag. And the data should be loaded when power returns using POF.

Thanks and regards, Nick

Reply to
Nick

Serial, parallel ?

Manufacturer and part number ?

Graham

Reply to
Pooh Bear

And you're sure the poweroff time was virtually zero ? It could be days or weeks.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

using

Much better. :-) You could connect an input pin to the power supply to determine when the power fails. By using an appropriately sized capacitor and a blocking diode, you should be able to maintain power long enough to write the information to the (internal?) EEPROM. Here is a Microchip app note that shows one way to do it:

formatting link
D1, C5 and C6 in the schematic maintain power long enough to write information to the internal EEPROM.

Reply to
Anthony Fremont

The on-chip 512 bytes of user Eeprom is treated as 'XDATA' - auxilliary data type.

? XDATA ?External? Data or Auxiliary RAM. Duplicates the classic 80C51 64 kB memory

space addressed via the MOVX instruction using the SPTR, R0, or R1. All or part of this space could be implemented on-chip. The P89LPC932 has 512 bytes of on-chip XDATA memory.

Page 19 of the data sheet.

See your compiler for the correct method to address this area of memory. Some familiarity with 80C51 processor types will be assumed.

Graham

Reply to
Pooh Bear

Oops - spoke too soon.

8.26 Data EEPROM The P89LPC932 has 512 bytes of on-chip Data EEPROM. The Data EEPROM is SFR based, byte readable, byte writable, and erasable (via row fill and sector fill). The user can read, write and fill the memory via SFRs and one interrupt. This Data EEPROM provides 100,000 minimum erase/program cycles for each byte. ? Byte Mode: In this mode, data can be read and written one byte at a time. ? Row Fill: In this mode, the addressed row (64 bytes) is filled with a single value. The entire row can be erased by writing 00h. ? Sector Fill: In this mode, all 512 bytes are filled with a single value. The entire sector can be erased by writing 00h. After the operation finishes, the hardware will set the EEIF bit, which if enabled will generate an interrupt. The flag is cleared by software.

Page 41. That sounds delightfully vague.

Ok - you nead the *USER MANUAL*. The datasheet isn't enough.

Page 115 on tells you how to use it. You need to know how to access the SFRs. Do you have this level of experience with the 80C51 architecture ? You need to tell your compiler about the special function registers i.e. their addresses.

I think I'll stick with external serial Eeproms ! ;-)

Graham

Reply to
Pooh Bear

"Nick" schreef in bericht news: snipped-for-privacy@g47g2000cwa.googlegroups.com...

I'd go for a battery backed RTC and a smal (eight - or even six pins) micro. This way you need to loose neither time nor data on power failure.

petrus bitbyter

Reply to
petrus bitbyter

Hi,

Serial data writing byte by byte

Philips P89LPC32

Thanks, Nick

Reply to
Nick

Hi,

I already gone for that option but going through the datasheet and due to my application needs. My output needs to be ON after 500hrs - (167740 seconds) hours of ON time (power fail time not considered).

Thanks, Nick

Reply to
Nick

Your serial EEPROM (whether I2C, SPI, or Microwire) is going to take a

*long* time (milliseconds) to complete a write successfully. You'll need to ensure that its power supply remains within spec for the worst-case write period under all possible conditions (including partial turn-on followed by failure). This requirement may convince you to try some other approach to your problem!

Can't you use the on-chip RAM to hold the time and power-down the chip?

Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

So, your application is similar to an automobile odometer. You can find clever ways of writing to the EEPROM only while the power is on, and dealing with EEPROM life and data corruption issues.

Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

Then there are FRAMS, devices that can take

10^12 write cycles. They can store information without power. Just update it every second or so.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

^^^^^^^^ I googled and went to philips web site.

Is this a cpu or an eeprom ??

Reply to
Donald

It's an mcu with internal eeprom.

Graham

Reply to
Pooh Bear

It's a flash rom 8051 variant. LPC stands or "low pin count". There's some confusion over whether he's using the internal EEPROM (parallel) or external (probably serial, which is what he says he's doing).

Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

You mean the internal Eeprom in the LPC932 ? It's not serial.

Make your mind up.

Graham

Reply to
Pooh Bear

Thats what I thought.

What does the manual say about programming 'internal' eeprom ???

Like other internal eeprom'd chips, there are registers you need to write to before writing to the eeprom cell array.

donald

Reply to
Donald

"Anthony Fremont" wrote

to

is

Is there something wrong with using this method?

Reply to
Anthony Fremont

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.