I2C Object
dpientak51
Posts: 7
in Propeller 1
Does anyone have an I2C serial object available for the P1? I need to communicate with an I2C ADC.
Comments
Which device? May be in the OBEX ZIP file which I can give you.
The two copyrights are listed as:
2010 Dave Hein
2014 Chris Gadd
I don't think these have clock stretching options. I'm pretty sure I wrote an I2C driver which uses clock stretching so if you need that feature, let me know and I'll try to find a working version of my driver.
I greatly Appreciate it all!
I also need to write a few of my veriable to the epprom, to save for a power cycle so I can retain the data. Are these the best I2C to use for this too? Looked like I saw some post referring to one thats designed to work with the epprom.
Anyway, if JM recommended it, why question it as if "someone" else's opinion would be accepted over what works?
If you have a Variable in a DAT section the address of the Variable in HUB is also the address of the Variable in EEPROM.
so a i2c.write(@myVar, myVar) will store your value at exact the same location the spin compiler put myVar in the EEPROM while programming.
And at the next reboot you have your new value there.
While programming the EEPROM the P1 uses a checksum to confirm the EEPROM is valid, while booting from the EEPROM the checksum is not checked.
Easy to handle, except your settings get lost when you overwrite your EEPROM with a newer version of your program.
Most Parallax boards have 64K EEPROMS (careful, not all), but just the first 32K are used (and overwritten) while programming. So if you need settings survive reprogramming you will need to use EEPROM addresses above 32K.
And just use @JonnyMac's objects he posted, can't go wrong
Mike
As Mike points out, if you use the variable save approach those values will be wiped out if the program is updated. Values saved in the upper EE will persist between downloads, but require extra code to move between the upper EE and the application.