Basic_I2C_Driver SPIN OBJECT and I2C EEPROM
TransistorToaster
Posts: 149
Hello,
I hooked up a second 24lc256 EEPROM with shared I2C lines with the one that has the Propeller code and changed the address on the pin to be a0=1 a1=0 a2=0. I tried using the Basic_I2C_Driver spin object from http://ww1.parallax.com/Support/PropellerLibrary/tabid/65/Default.aspx
obex.parallax.com/objects/26/
and it's not quite working properly.
Now, I thought that the address I was supposed to use is $A0 + 2 = $A2. The two is because of the a0=1 a1=0 a2=0 and in the 24lc256 PDF ww1.microchip.com/downloads/en/DeviceDoc/21203P.pdf page 8, I thought this was right for this type of device on the I2c bus.
Question 1:
What is wrong with my below code? It's not storing and retrieving timeMin and timeHour increments by 1 each time:
Question 2:
I found this in the SPIN driver itself. What is this for?
Thanks,
Frank
I hooked up a second 24lc256 EEPROM with shared I2C lines with the one that has the Propeller code and changed the address on the pin to be a0=1 a1=0 a2=0. I tried using the Basic_I2C_Driver spin object from http://ww1.parallax.com/Support/PropellerLibrary/tabid/65/Default.aspx
obex.parallax.com/objects/26/
and it's not quite working properly.
Now, I thought that the address I was supposed to use is $A0 + 2 = $A2. The two is because of the a0=1 a1=0 a2=0 and in the 24lc256 PDF ww1.microchip.com/downloads/en/DeviceDoc/21203P.pdf page 8, I thought this was right for this type of device on the I2c bus.
Question 1:
What is wrong with my below code? It's not storing and retrieving timeMin and timeHour increments by 1 each time:
... long timeDay long timeHour long timeMin ... i2c.Initialize(28) eepromStatus:= i2c.ReadPage(28, $A2, 2*(7*60*24)+0 , @timeMin, 1) '' abort ' an error occured during the write eepromStatus:= i2c.ReadPage(28, $A2, 2*(7*60*24)+1 , @timeHour, 1) '' abort ' an error occured during the write eepromStatus:= i2c.ReadPage(28, $A2, 2*(7*60*24)+2 , @timeDay, 1) '' abort ' an error occured during the write ....code which is not relevant... eepromStatus:= i2c.WritePage(28, $A2, 2*(7*60*24)+0 , @timeMin, 1) '' abort ' an error occured during the write eepromStatus:= i2c.WritePage(28, $A2, 2*(7*60*24)+1 , @timeHour, 1) '' abort ' an error occured during the write eepromStatus:= i2c.WritePage(28, $A2, 2*(7*60*24)+2 , @timeDay, 1)
Question 2:
'' CON '' eepromAddress = $7000
I found this in the SPIN driver itself. What is this for?
Thanks,
Frank
Comments
2) That's part of the sample code. It has nothing to do with the driver itself.
Frank