对于LPC54102的IIC驱动还需要好好研究下,现在先使用io模拟IIC来测试MPU6050.
#define SET_SCL_OUTPUT Chip_GPIO_SetPinDIROutput(LPC_GPIO,0, 23)
#define Set_SCL Chip_GPIO_SetPinState(LPC_GPIO,0, 23,true)
#define Clr_SCL Chip_GPIO_SetPinState(LPC_GPIO,0, 23,false)
#define SET_SDA_OUTPUT Chip_GPIO_SetPinDIROutput(LPC_GPIO,0, 24)
#define Set_SDA Chip_GPIO_SetPinState(LPC_GPIO,0, 24,true)
#define Clr_SDA Chip_GPIO_SetPinState(LPC_GPIO,0, 24,false)
#define SET_SDA_INPUT Chip_GPIO_SetPinDIRInput(LPC_GPIO,0, 24)
#define GET_SDA_DATA Chip_GPIO_GetPinState(LPC_GPIO,0, 24)
#define uchar unsigned char
void delay(unsigned int value);
void I2C_Start(void);
void I2C_Send_Byte(uchar data);
void Check_Ack(void);
void I2C_Stop(void);
uchar I2C_Receive_Byte(void);
void I2C_Nack(void);
void single_byte_write(uchar REG_Address, uchar REG_DATA);
uchar single_byte_read(uchar REG_Address);
void Send_Ack(void);
调试结果接下来分享。