eeprom data as a symbol
Have some 50 configuration variables stored in eeprom. (28X1 FW ver A.1)
There are too many to store in normal variables and leave them there.
Storing to scratchpad would be OK but entails some overhead in setting the pointer or reading the scratchpad directly to a variable i.e. no gain over a read eeprom address.
I finally hit on the idea of reading the eeprom to a ptr and creating a symbol from the ptr.
The objective here is to save on program size (hitting the limit), and improve processing speed.
let b0 = 110 'testing only,
write 137,b0 'normally a permanent value
read 137,@ptr
symbol ee137=@ptr
The idea was to do this for each eeprom value at the initialisation of the program and then use the symbol directly in the program.
This all passes the syntax checker and looks good in the simulator, and tested by sertxd("ee137 ",#ee137) which produces the correct result anywhere in the program.
However when running the simulator with;
in place of;
b21 is 44 instead of 110,
and,
b20 therefore becomes 46 instead of 115
The simulator shows all the expected values being stored in eeprom, scratchpad, and symbol during the initialisation phase.
However when using the different symbols in the program, the symbol seems always to be 44 even though a sertxd reports the expected value for the symbol.
Any help gratefully received.
Thanks
Have some 50 configuration variables stored in eeprom. (28X1 FW ver A.1)
There are too many to store in normal variables and leave them there.
Storing to scratchpad would be OK but entails some overhead in setting the pointer or reading the scratchpad directly to a variable i.e. no gain over a read eeprom address.
I finally hit on the idea of reading the eeprom to a ptr and creating a symbol from the ptr.
The objective here is to save on program size (hitting the limit), and improve processing speed.
let b0 = 110 'testing only,
write 137,b0 'normally a permanent value
read 137,@ptr
symbol ee137=@ptr
The idea was to do this for each eeprom value at the initialisation of the program and then use the symbol directly in the program.
This all passes the syntax checker and looks good in the simulator, and tested by sertxd("ee137 ",#ee137) which produces the correct result anywhere in the program.
However when running the simulator with;
Code:
b21 = ee137
b20 = ee137 /20 +ee137
If b1 > b20 Then
Goto SpeedEnd
EndIf
Code:
read 137,b21
b20 = b21/20+b21
If b1 > b20 Then
Goto SpeedEnd
EndIf
and,
b20 therefore becomes 46 instead of 115
The simulator shows all the expected values being stored in eeprom, scratchpad, and symbol during the initialisation phase.
However when using the different symbols in the program, the symbol seems always to be 44 even though a sertxd reports the expected value for the symbol.
Any help gratefully received.
Thanks
Last edited: