Go Down

Topic: Which ASCII symbol it's on EEPROM by default? (Read 701 times) previous topic - next topic

pedroferrer

Good afternoon

I would like to know if somebody can tell me which ASCII symbol it's on EEPROM by default, on 1st reading.

Thanks on advance
Best regards
Pedro Ferrer

Korman

I think it was 0xff (all bits set), but don't take this as gospel. Better write a little program that reads from a blank eeprom location.

Korman

Grumpy_Mike

Yes it is 0xff - this is not really an ASCII symbol it is just a bit pattern.

pedroferrer

#3
Oct 12, 2010, 02:44 pm Last Edit: Oct 12, 2010, 02:44 pm by pedroferrer Reason: 1
Good afternoon

Thank you guys!

Best regards
Pedro Ferrer

pedroferrer

Good afternoon

i 've forgot to ask...
The var that will receive the value from EEPROM has to be a * char?
To read 0xff...

Thanks on advance
Best regards
Pedro Ferrer

Grumpy_Mike

No any variable reading that byte will return 0xff

Korman

But before you go off the deep end, 0xff (or -1 for signed character types) are also legal values. Even worse, if someone used the EEPROM before with another Program, the EEPROM can contain data which are junk for the current one. So don't bother checking for 0xff, it will give you only heartache and pain.

If you want to know if the EEPROM has been already written your current application, write a magic marker (eg the integer 6934 at the beginning and a CRC or checksum at the end of your data. If both are present and correct, your chances are greater that that nobody messed with the data, although it's not perfect.

Korman

Go Up