Datasheet

Jon Waddington
40
3.7.1 Memory backup
I2C is also used by the Propeller to write to the memory in EEPROM. This can be used to
backup contents of the Propellers RAM, meaning that when the system is reset, the
backed up content is automatically restored.
This is used in the Information System when the user adds an X10 module to the
system, the Propeller writes all the associated information to the EEPROM. The same
process is undergone if the user deletes or edits an X10 module.
The code below shows how the backup method backs up the data.
VAR
byte sel
byte code
byte name[160]
byte dvc[16]
byte addr[16]
byte room[16]
byte type[16]
byte dvcnum
byte rcflag
byte snum[8]
PRI backup
{{backs up user entered x10 devices}}
eeprom.VarBackup(@name, @dvcnum)
The main program calls the backup method and passes the first name of the variable to
be backed up and the last name. All the variables between, as listed in the VAR block,
are also backed up.
The code below shows the restore method. This is called when the Information System is
initialising after boot up. It has the same names of variables passed into it.
PRI restore
{{restores backed-up user entries}}
eeprom.VarRestore(@name, @dvcnum)