pciGrabber-4x4
140
PHYTEC Messtechnik GmbH 2008 L-720e_0
BYTE I2C_ReadByte (WORD nDevNo, BYTE bChipAddress,
BYTE bSubAddress, BYTE *bByteRead)
bChipAddress: Device address for the I²C device on the bus
bSubAddress: Internal memory address for the I²C device
*bByteRead:
Pointer points to a Byte variable. Result
is written into the Byte variable.
return value:
SUCCESS, NOACK, INVALID_ADDRESS
I2C_ReadByte
is used to read a Byte from the memory space of an I²C
device. The result is given in a variable Byte type. This Byte must be
defined before hand.
The function returns an error code as a return value.
NOACK
indicates
that no I²C device has been registered under the given device address.
INVALID_ADDRESS
indicates an unsuccessful attempt to access the
protected area of the EEPROM mounted on the Grabber.
BYTE I2C_WriteByte (WORD nDevNo, BYTE b ChipAddress,
BYTE bSubAddress, BYTE bData)
bChipAddress: Device address of the
I²C device on the bus
bSubAddress: Internal memory address of the
I²C device
bData:
Byte written into the specified address
return value:
SUCCESS, NOACK, INVALID_ADDRESS,
WRITE_FAILED
Writes a Byte into the memory space of a specified I²C device.
The function returns an error code as a return value. After writing, the
function reads the string and checks to make sure that the written and
read values are identical. If the values are not identical, then the error
code
WRITE_FAILED
is returned.
Note:
For registers that have different functions in read and write accesses
(i.e. status / command), most of the time the read value does not match
the written value. In this case,
WRITE_FAILED
is returned, although
the write operation was successful.