User manual

I2C API reference
52 © 2007-2010 Analytica GmbH
I2CSequence
I2CSequence — This command is used to write a sequence of write and read commands to an I2C device.
Syntax
#include <AnaGateDllI2C.h>
int I2CSequence(int hHandle, const char * pcWriteBuffer, int
nNumberOfBytesToWrite, char * pcReadBuffer, int nNumberOfBytesToRead,
int * pnNumberOfBytesRead, int * pnByteNumberLastError);
Parameter
hHandle Valid access handle.
pcWriteBuffer byte buffer, containing the commands which are to be sent to the
AnaGate I2C. The single commands are stored sequential in this byte
buffer.
A read command is defined as follows:
Structure of read command for I2CSequence
Read command Description
2 bytes (LSB,MSB) slave address in 7- or 10-bit format, the R/W
bit must be set to explicitely to 1.
2 bytes (LSB,MSB) number of data bytes to be read from the I2C
device. The successfully read data bytes are
stored in the pcReadBuffer buffer.
A write command is defined as follows:
Structure write command for I2CSequence
Write command Description
2 bytes (LSB,MSB) slave address in 7- or 10-bit format, the R/W
bit must be set to explicitely to 1.
2 bytes (LSB,MSB) number of data bytes to be written to the I2C
device.
N bytes data bytes.
nNumberOfBytesToWrite byte size of the data to write
pcReadBuffer byte buffer, in which the received data is to be stored. The received data
from different commands are stored in the buffer sequential (first the
data of command 1, then the data of command 2, ...).
nNumberOfBytesRead byte size of the read buffer (must be big enough for all included read
requests)
pnNumberOfBytesRead byte count, which is read from I2C.