Connect with us

Writing to EEPROM

Discussion in 'Electronic Design' started by Nick, Feb 10, 2006.

Scroll to continue with content
  1. Nick

    Nick Guest

    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
     
  2. PN2222A

    PN2222A Guest

    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
     
  3. Nick

    Nick Guest

    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
     
  4. Pooh Bear

    Pooh Bear Guest

    Serial, parallel ?
    Manufacturer and part number ?

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

    Rene
     
  6. 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.
     
  7. Pooh Bear

    Pooh Bear Guest

    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
     
  8. Pooh Bear

    Pooh Bear Guest

    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
     
  9. 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
     
  10. Nick

    Nick Guest

    Hi,

    Serial data writing byte by byte
    Philips P89LPC32
    Thanks,
    Nick
     
  11. Nick

    Nick Guest

    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
     
  12. 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
     
  13. 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
     
  14. 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
     
  15. Donald

    Donald Guest

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

    Is this a cpu or an eeprom ??
     
  16. Pooh Bear

    Pooh Bear Guest

    It's an mcu with internal eeprom.

    Graham
     
  17. 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
     
  18. Pooh Bear

    Pooh Bear Guest

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

    Make your mind up.

    Graham
     
  19. Donald

    Donald Guest

    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
     
  20. Is there something wrong with using this method?
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-