Every slave device, connected to the I2C bus, must have an unique I2C address. The I2C address can be either 7-bits or 10-bits long.
If you use I2C slave interface of a DLN-series adapter, call DlnI2cSlaveSetAddress() to configure the I2C address. You can specify several I2C slave addresses. DLN-series adapter will respond to any of these addresses. After I2C master generates Stop Condition, DLN series adapter sends DLN_I2C_SLAVE_WRITE_EV or DLN_I2C_SLAVE_READ_EV event to your application. These events contain the I2C address in the slaveAddress field.
7-bit I2C Addressing
The first byte (immediately after the START condition) contains the I2C slave address.
The I2C address is 7-bits long. It is transmitted in the seven most significant bits (MSB). The last (eighth bit) of the I2C address byte is a data direction bit - a 'zero' indicates a transmission (I2C WRITE), a 'one' indicates a request for data (I2C READ).
You have to specify the 7-bit I2C slave address when you call the DlnI2cMasterRead() or DlnI2cMasterWrite() function. DLN-series PC-I2C adapters automatically add the direction bit. In fact the provided I2C address is shifted left and is supplemented by 0 (for I2C write transactions) or by 1 (for I2C read transactions).
DLN-series adapters can scan the bus for I2C addresses of the connected slave devices. Call the DlnI2cMasterScanDevices() function to get the list of I2C addresses.
10-bit I2C Addressing
With 7-bit addressing only 112 I2C slave addresses are available. To prevent address clashes Philips Semiconductors (now NXP Semiconductors) has introduced a 10 bit address scheme. Devices with 7-bit and 10-bit addresses can be connected to the same I2C-bus.
The 10-bit address is transmitted within the first two bytes following a START condition or a repeated START condition.
Five most significant bits of the first address byte are predefined (1111 0). I2C slave devices with 7-bit addressing ignore transactions with the first byte in the form of '1111 0XXX'.
The I2C address occupies bits 5 and 6 of the first byte and the eight bits of the second byte.
The transfer direction (read or write) is specified in the eighth bit of the first byte. As in the case of 7-bit I2C address, a 'zero' indicates a transmission (I2C WRITE), a 'one' indicates a request for data (I2C READ).
Slave devices with 10-bit I2C addressing will react to a general call in the same way as slave devices with 7-bit I2C addressing. I2C master devices can transmit the 10-bit I2C address after a general call.
I2C General Call Address
The general call address is used to address all I2C slave devices simultaneously. If I2C slave device doesn't support general call addressing, it ignores this transaction and doesn't issue an acknowledgment. The I2C master devise can't determine how many slave devices acknowledge the general call address.
You can enable the I2C general call address support for I2C slave interface with the DlnI2cSlaveGeneralCallEnable() function.
Reserved I2C slave addresses
There are 16 reserved I2C addresses. These addresses corresponds to one of the two patters: 0000XXX or 1111XXX. The table below describes the purposes of the most commonly used reserved I2C addresses:
|I2C Slave Address||R/W||Bit Description|
|0000 000||0||general call address|
|0000 000||1||START byte[|
|0000 001||X||CBUS address|
|0000 010||X||reserved for different bus format|
|0000 011||X||reserved for future purposes|
|0000 1XX||X||Hs-mode master code|
|1111 1XX||X||reserved for future purposes|
|1111 0XX||X||10-bit slave address|
The full list of I2C address assignments you can see at I2C Address Allocation Table.