Other Parts Discussed in Thread: PCF8574
Dear All:
I have written a sample code to operate pcf8574 using the pcf8574tlib, but whatever do I press the button, the value get from function pcf8574t_getdat is the same,but the return value is successful. The following is my code:
#include <stdio.h>
#include "/home/userfordm355/dvsdk_1_30_00_23/demos/utils/include/pcf8574tlib.h"
int main()
{
unsigned char buf[2];
if(pcf8574t_init(0x20)!=I2C_FAILURE)
{
printf("pcf8574 is initiliazed Successful! \n");
}
if(pcf8574t_getdat(buf)==I2C_SUCCESS)
{
printf("pcf574 getdata Successful,value is %x!\n",buf[0]);
}
pcf8574t_exit();
return 0;
}
Can anybody tell my why?
thanks!