Question - I2C Device Address

Thread Starter

rt694157

Joined Dec 15, 2019
68
I'm not asking this question for any specific device. You can take device of your choice for example. Each slave address given in datasheet. Datasheet doesn't state whether address should be store in integer or it should be store in char type

1) When we write code for I2C device How do we decide whether address should be store in integer or it should be store in char
2) Is there any specific reason to store device address in unsigned char ?

regards
Rahul
 

andrewmm

Joined Feb 25, 2011
1,474
The I2C has no knowledge of data types,
to it , its only a string of 1 or 0.

Its a 8 bit address, the LSB of which is the read / write bit.

You need to look at what routine your using to send the data over the serial,
And if its big or little endian.

( most people I know who write there own I2C, just try one way, and look with scope, if its back to front they bit reverses in the code )

so if your device is address 7Ch,
then the device is expecting to see,
start 11111000 stop on the I2C serial bus,
 
Top