Pitx-sp software guide – Kontron pITX-SP User Manual
Page 30
Advertising
KTD-S0003-C
Page 26
CPLD Interface
p
ITX-SP Software Guide
//*********************************************************
//* Reads a byte from I2C device (main routine)
//*********************************************************
void ReadI2CDevice (int device_addr)
{
int byte_read;
I2C_Reset
();
I2C_Stop
();
I2C_Start
();
I2C_Byte_Out (device_addr | 1);
byte_read = I2C_Byte_In ();
I2C_Stop
();
do
something
}
void main (void)
{
if (WriteI2CDevice (DEVICE_PCF8574, 0xA5))
ReadI2CDevice
(DEVICE_PCF8574);
}
Advertising