|
PE Kit Lab Applications – EEPROM Datalogging and I2C
Attached is the first application installment for the next Propeller Education Kit lab – EEPROM Datalogging and I2C. Test Propeller Eeprom v0.677...zip is a HyperTerminal application for testing the Propeller Eeprom object’s VarBackup, VarRestore, FromRam, and ToRam methods. It allows you define values stored by selected array elements and then copy the array from main RAM to EEPROM and visa versa.
Example:
VAR
long values[32]
OBJ
eeprom : “Propeller Eeprom”
PUB Main
...
eeprom.VarBackup(@values, @values[31] + 3) ‘ Backup
...
eeprom.VarRestore(@values, @values[31] + 3) ‘ Restore
One interesting and particularly useful application of the Propeller Eeprom object’s VarBackup method is that values that were copied from the main RAM’s variable memory to EEPROM are automatically restored to variable memory on reboot. (Thanks and kudos to Jeff Martin for suggesting this approach!) The VarRestore method can also be used to programmatically restore variable memory to an earlier state that was copied to EEPROM by VarRestore.
The zip’s Propeller Eeprom object also has FromRam and ToRam methods for datalogging values to portions of EEPROM not used for program and variable storage.
Example:
...
‘ Copy array to EEPROM starting at eeAddr to eeAddr + 127.
eeprom.FromRam(@value, @value[31] + 3, eeAddr)
...
‘ Copy from eeAddr to eeAddr + 127 to value[0]..value[31].
eeprom.ToRam(@value, @value[31] + 3, eeAddr)
Please send corrections to editor@parallax.com, and post suggestions and recommendations to this thread.
PE Kit Labs that have already gone through the review process are available for download from the Propeller Education Kit page. You can also find discussions for each lab along with the latest drafts in progress on the Propeller Education Kit Labs thread.
Andy Lindsay
Education Department
|