Instructions

274Libraries
© 2013 Conrad Electronic
5.12.2.1
I2C_Probe
I2C Functions
Syntax
byte I2C_Probe(byte addr);
Sub I2C_Probe(addr As Byte) As Byte
Description
I2C_Probe tries to address an I2C device and gives as result whether the attempt was successful.
Parameter
addr address of I2C device
Return Parameter
1 = device has answered
0 else
5.12.2.2 I2C_Read
I2C Functions
Syntax
byte I2C_Read(byte addr, dword hdr, byte hdr_len, byte mem_addr[],
word length);
Sub I2C_Read(addr As Byte, hdr As ULong, hdr_len As Byte,
ByRef mem_addr As Byte, length As Word) As Byte
Description
First, up to 4 bytes of header data are written to the I2C device with address addr (I2C 7-bit address).
The data is passed in hdr (dword), the number of bytes in hdr_len. The hdr_len may be zero, means
that is there is no header data transferred. There are always the first high-order bytes of the header
transmitted (big endian). After transferring the header, length bytes are written from the I2C device
into the array mem_addr.
The term header stands not for a specific I2C term, but for up to 4 bytes, that are transmitted to
the I2C device. Many I2C devices use such a header, e.g. as to index a register.
Parameter
addr address of I2C device
hdr up to 4 byte header data
hdr_len length of header
mem_addr array in that the I2C device data is copied into