这是读写的时序
//产生IIC起始信号
void IIC_Start(void)
{
SDA_OUT(); //sda线输出
SDA_HIGH;
SCL_HIGH;
delay_us(4);
SDA_LOW; //START:when CLK is high,DATA change form high to low
delay_us(4);
SCL_LOW; //钳住I2C总线,准备发送或接收数据
}
//产生IIC停止信号
void IIC_Stop(void)
{
SDA_OUT(); //sda线输出
SDA_LOW; //STOP:when CLK is high DATA change form low to high
delay_us(4);
SCL_HIGH;
delay_us(4);
SDA_HIGH; //发送I2C总线结束信号
delay_us(4);
}