Shop OBEX P1 Docs P2 Docs Learn Events
Some advice needed to write modified data back into the boot eeprom for usage a — Parallax Forums

Some advice needed to write modified data back into the boot eeprom for usage a

Christof Eb.Christof Eb. Posts: 1,162
edited 2008-06-11 18:36 in Propeller 1
Hi, I would be very thankful for some help!

I want to do the following:


....

PUB main
....
a:=b*var1     'use predefined variable
....
var1:= xyz     'modify predefined variable

writeback(@var1,1)    ' ??????? IS THERE A FUNCTION TO WRITE BACK A MODIFIED LONG INTO THE BOOT EEPROM?????
.....

DAT
var1   long   27     'have a variable in a dat-section with predefined data





Thanks alot for some input!
Christof

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-11 17:08
    Look in the Propeller Object Exchange under the topic Data Storage. You'll find several objects that can be used to write to (or read from) EEPROM. If you write the variable back to the same location in EEPROM as it has in RAM (@var1), then, when the program next loads, the variable will have the new value.
  • Christof Eb.Christof Eb. Posts: 1,162
    edited 2008-06-11 18:36
    Thank you, Mike,
    I was not aware, that it was such simple, perhaps someone is looking for something too. So I post the solution
    Christof

    CON
    ....
      i2cSCL        = 28
    '  i2cSDA        = 29
      EEPROMAddr    = $A0
    .....
    
    OBJ
      i2cObject      : "basic_i2c_driver"
    ......
    PUB main
    ....
        evar1++   'Modify the variable
        writeback_long(@evar1)
    ....
    PUB writeback_long(adr) | eepromlocation, eepromData 
        eepromlocation:= adr
        eepromData:=     LONG[noparse][[/noparse]adr]
        i2cObject.WriteLong(i2cSCL, EEPROMAddr, eepromLocation, eepromData)
    ....
    
    DAT
    evar1                   long    42
    
    
Sign In or Register to comment.