Maker Pro
Maker Pro

Writing to EEPROM

N

Nick

Jan 1, 1970
0
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
 
P

PN2222A

Jan 1, 1970
0
Nick said:
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?

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
 
N

Nick

Jan 1, 1970
0
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
 
P

Pooh Bear

Jan 1, 1970
0
Nick said:
hi,
I need help in writing data to Eeprom.

Serial, parallel ?
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?

Manufacturer and part number ?

Graham
 
R

Rene Tschaggelar

Jan 1, 1970
0
Nick said:
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.

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

Rene
 
A

Anthony Fremont

Jan 1, 1970
0
Nick said:
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.

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:
http://ww1.microchip.com/downloads/en/appnotes/01013a.pdf
D1, C5 and C6 in the schematic maintain power long enough to write
information to the internal EEPROM.
 
P

Pooh Bear

Jan 1, 1970
0
Nick said:
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.

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
 
P

Pooh Bear

Jan 1, 1970
0
Pooh said:
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.

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
 
P

petrus bitbyter

Jan 1, 1970
0
Nick said:
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

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
 
N

Nick

Jan 1, 1970
0
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
 
S

Spehro Pefhany

Jan 1, 1970
0
Hi,


Serial data writing byte by byte

Philips P89LPC32


Thanks,
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
 
S

Spehro Pefhany

Jan 1, 1970
0
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

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
 
R

Rene Tschaggelar

Jan 1, 1970
0
Nick said:
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).

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
 
D

Donald

Jan 1, 1970
0
Nick said:
Hi,




Serial data writing byte by byte



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

Is this a cpu or an eeprom ??
 
P

Pooh Bear

Jan 1, 1970
0
Donald said:
^^^^^^^^
I googled and went to philips web site.

Is this a cpu or an eeprom ??

It's an mcu with internal eeprom.

Graham
 
S

Spehro Pefhany

Jan 1, 1970
0
^^^^^^^^
I googled and went to philips web site.

Is this a cpu or an eeprom ??

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
 
P

Pooh Bear

Jan 1, 1970
0
Nick said:
Hi,

Serial data writing byte by byte

Philips P89LPC32

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

Make your mind up.

Graham
 
D

Donald

Jan 1, 1970
0
Pooh said:
Donald wrote:




It's an mcu with internal eeprom.

Graham
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
 
A

Anthony Fremont

Jan 1, 1970
0
Anthony Fremont said:
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:
http://ww1.microchip.com/downloads/en/appnotes/01013a.pdf
D1, C5 and C6 in the schematic maintain power long enough to write
information to the internal EEPROM.

Is there something wrong with using this method?
 
Top