I'm confused and can't seem to find the answer I'm looking for. The way I'm interpret the I2C setup is as follows
hi2csetup i2cmaster, Slaveaddress, Mode, Addresslen:
I'm confused by the address. In my world, when I have a device with an address of 68, I refer to address 68 and not %11010000 or 208. I'm getting this from my DS1307. I know that the devices address is 68 so how does the address of %11010000 know to talk to address 68?
This is the setup for the DS1307 which is working well.
hi2csetup i2cmaster, %11010000, i2cslow_8, i2cbyte
I'm asking this because I'm now trying to get a 24LC256 working and cant seem to get there. All I want is to write a 0x09 to slot 0 in the EEPROM which is at address 50 and I think that understanding the addressing better, I'll have more luck. Here is the code which is pieced from info I have found.
No matter what I try to write, I get a value of 161 returned. What the heck am I missing here?
hi2csetup i2cmaster, Slaveaddress, Mode, Addresslen:
- HI2CSETUP = Tell the picaxe you want to use and setup I2c
- I2CMASTER = Master mode aka the one in command
- Slaveaddress = The address of the slave that you want to communicate with (where I'm confused).
- Mode = Slow or fast
- Addresslen = The data type. Either byte or word
I'm confused by the address. In my world, when I have a device with an address of 68, I refer to address 68 and not %11010000 or 208. I'm getting this from my DS1307. I know that the devices address is 68 so how does the address of %11010000 know to talk to address 68?
This is the setup for the DS1307 which is working well.
hi2csetup i2cmaster, %11010000, i2cslow_8, i2cbyte
I'm asking this because I'm now trying to get a 24LC256 working and cant seem to get there. All I want is to write a 0x09 to slot 0 in the EEPROM which is at address 50 and I think that understanding the addressing better, I'll have more luck. Here is the code which is pieced from info I have found.
Code:
setfreq m8
pause 1000
hi2csetup i2cmaster, %10100000,i2cfast,i2cword
pause 10 ;optional delay time
hi2cout 0,($09) ;save raw Minutes
pause 10 ;recommended write delay time
geteeprom:
hi2csetup i2cmaster, %10100000,i2cfast,i2cword
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0, cr, lf)
pause 500
goto geteeprom