U2C_Write()

U2C_RESULT U2C_Write(
      HANDLE hDevice,
      PU2C_TRANSACTION pTransaction
);

The U2C_Write() function writes up to 256 bytes into 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 write transaction. Before calling the function this structure have to be filled:

  • nSlaveDeviceAddress - must contain the I 2 C 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 I 2C slave device.
  • MemoryAddress - must contain the internal I 2 C slave device address.
  • nBufferLength - must contain the number of bytes to be written into the I 2 C slave device.
  • Buffer - must contain the data to be written into the I 2 C slave device.

Return values:

U2C_SUCCESS

The data was successfully written into the I2C slave device.

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_SENDING_MEMORY_ADDRESS_FAILED

I2C slave device did not acknowledge internal address.

U2C_SENDING_DATA_FAILED

I2C slave did not acknowledge data output.

Rating: 
Голосов пока нет