Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 2 months ago.
I2c problem ?? anyone
Hi
I am trying to use mbed as an external master with Cypress Power lines Kits through the I2C interface. My kit has an I2C address of 0x01 now i am confused how should i refer to this address using the mbed I2C library as we have first seven bits of address and the LSB is for read/write (1/0). for example to write a byte of data should i use
I2C.write('0x01', data, length) ...but the LSB is 1 meaning it is a read ??? does it
or
I2C.write('0x02', data, length) ...but the LSB is 0 meaning it is a write and rest of the seven bits make an address of 0x01 ??
Anyone with anyhelp in this regard ?
Thanks
1 Answer
11 years, 2 months ago.
Second option. Mbed uses 8-bit addresses for i2c: You already need to have it switched one place yourself, so you need to use 0x02. The LSB is set by the i2c library, so you dont have to worry about it and you can keep it at zero (or one, doesn't matter either way).