I2Ctest.c
user6477475:
核心代码如下:(I2C打开和初始化都是ok的)
#define SCL_PIN Board_I2C_SCL
#define SDA_PIN Board_I2C_SDA
#define SCL_PIN_HIGHT GPIO_write(SCL_PIN,1)
#define SCL_PIN_LOW GPIO_write(SCL_PIN,0)
#define SDA_OUT (GPIO_setConfig(SDA_PIN, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW))
#define SDA_IN (GPIO_setConfig(SDA_PIN, GPIO_CFG_INPUT))
#define SDA_PIN_HIGHT GPIO_write(SDA_PIN,1)
#define SDA_PIN_LOW GPIO_write(SDA_PIN,0)
#define SDA_PIN_READ GPIO_read(SDA_PIN)
void IIC_Start(void)
{
SDA_OUT;
SDA_PIN_HIGHT;
SCL_PIN_HIGHT;
// SDA_PIN_HIGHT;
SDA_OUT;
SDA_PIN_LOW;
SCL_PIN_LOW;
}
void Write_Add(uint8_t add,uint8_t comd,uint8_t wdata)
{
IIC_Start(); //产生一个起始信号
Write_IIC_Byte(add);
Write_IIC_Byte(comd);
Write_IIC_Byte(wdata);
IIC_Stop(); //产生一个终止信号
}
Write_Add(0x64,0x17,0xa8);
Kevin Qiu1:
回复 user6477475:
在CC2640上模拟IIC没有试过,测下SDA是否有信号输出