Dimax English Dimax French Dimax English Dimax Translations
USB-I2C/SPI/GPIO Interface Adapter - U2C-12
Reference Manual

U2C_Read


U2C_RESULT U2C_Read (
            HANDLE hDevice,
             PU2C_TRANSACTION pTransaction
);
 

The U2C_Read function reads up to 256 bytes from the I2C slave device.

Parameters:
hDevice Handle to the U2C-12 device.
pTransaction Pointer to the U2C_TRANSACTION structure to be used during the I2C read transaction. Before calling the function this structure has to be partially filled:
  • nSlaveDeviceAddress - must contain the I2C slave device address;
  • nMemoryAddressLength - must contain the internal address length (in bytes from 0 up to 4). If nMemoryAddressLength is equal to 0, no address will be sent to device and repeated I2C start condition won't be generated.
  • MemoryAddress - must contain the internal I2C slave device address.
  • nBufferLength - must contain the number of bytes to be read from the I2C slave device.
    After successful completion of the read operation Buffer member of the structure will be filled with data read from I2C slave device.
Return values:
U2C_SUCCESS The data was successfully read.
U2C_HARDWARE_NOT_FOUND U2C-12 device referenced by hDevice handle was not found.
U2C_SLAVE_OPENNING_FOR_WRITE_FAILED I2C slave device did not acknowledge write slave address.
U2C_SLAVE_OPENNING_FOR_READ_FAILED I2C slave device did not acknowledge read slave address.
U2C_SENDING_MEMORY_ADDRESS_FAILED I2C slave device did not acknowledge internal address.
            Copyright DIMAX 2002-2012