writing and reading to the eeprom
Posted: Mon Jul 19, 2010 11:10 am
Good day all. With eeprom writing and reading what is the rule when writing bytes to a location, then reading those bytes into a string var. I am trying to calculate some values up to 9 then storing the byte results in eeprom locations. I then tried to index the value into a string and print the results to an LCD Screen. The label in quotes prints but the values don't. i.e
// Calculating byte values and writing to the eeprom
digit_1 = eeprom(0)::Read[idx] // first I read the value that is stored in the location. Note Location is initialized with a 0 value.
If (digit_1 < 9) {
digit_1 = digit_1+1
eeprom(0)::Write(11, digit_1)
}
//Reading from the eeprom and writing to the string var
idx = 11
idx_2 = 0
loop count 9 { // there are up to a total of 9 digits
string var [idx-2]= eeprom(0)::Read[idx]
idx = idx + 1
idx_2 = idx_2 + 1
}
string var[idx_2] = 0
Macro.Return = string var
Command = string var
//Printing to the LCD screen
Command = "label" + Command
LCDDisplay(0)::Cursor(0,1)
LCDDisplay(0)::PringString(Command)
// Calculating byte values and writing to the eeprom
digit_1 = eeprom(0)::Read[idx] // first I read the value that is stored in the location. Note Location is initialized with a 0 value.
If (digit_1 < 9) {
digit_1 = digit_1+1
eeprom(0)::Write(11, digit_1)
}
//Reading from the eeprom and writing to the string var
idx = 11
idx_2 = 0
loop count 9 { // there are up to a total of 9 digits
string var [idx-2]= eeprom(0)::Read[idx]
idx = idx + 1
idx_2 = idx_2 + 1
}
string var[idx_2] = 0
Macro.Return = string var
Command = string var
//Printing to the LCD screen
Command = "label" + Command
LCDDisplay(0)::Cursor(0,1)
LCDDisplay(0)::PringString(Command)