Writing Text to EEPROM
geo_leeman
Posts: 190
in Propeller 1
I've been playing with storing things like product serial number, calibration dates, etc. in the upper 32K of a 64K EEPROM. I'm using Chris Gadd's I2C driver. In the attached example code I have a product date, name, and serial number setup, then write them to the EEPROM. You'll see the demo works perfectly and that's the issue! It seems like to me (and the other resident prop. person) that the date should be written to EEPROM by doing something like:
But instead a simple single writeByte works:
How is this so? The date is "01/19/16", which takes 8 bytes to store. It seems like the code attached should produce garbled non-sense instead of the actual desired result. (I'm really not storing a lot of this as strings, but stumbled on this and can't figure it out!)
I2C.writeBytes(EEPROM,DATE_Base,@Prod_Date, 8)
But instead a simple single writeByte works:
I2C.writeByte(EEPROM,DATE_Base,@Prod_Date)
How is this so? The date is "01/19/16", which takes 8 bytes to store. It seems like the code attached should produce garbled non-sense instead of the actual desired result. (I'm really not storing a lot of this as strings, but stumbled on this and can't figure it out!)
Comments
I've verified that the writeBytes method does store the entire string in EEPROM, but it must either be displayed one byte at a time, or read into an array and then displayed as a string:
Hey Chris. That makes perfect sense. Thank you for the quick and handy explanation! I didn't even remotely think of that possibility.
Also, thanks for this driver! I use it a lot. Cheers.