#include
#include
typedef unsigned char uint8;
typedef unsigned int uint16;
typedef unsigned long uint32;
sbit SDL=P2^1;
sbit SDA=P2^0;
delay()
{
_nop_();
_nop_();
_nop_();
_nop_();
}
IIC_start()
{
SDA=1;
delay();
SDL=1;
delay();
SDA=0;
delay();
SDL=0;
delay();
}
IIC_stop()
{
SDL=0;
delay();
SDA=0;
delay();
SDL=1;
delay();
SDA=1;
delay();
}
IIC_send(uint8 byte)
{
uint8 i,j=0x80;
for(i=0;i>=1;
delay();
SDL=1;
delay();
SDL=0;
delay();
}
SDL=0;
delay();
SDA=1;
delay();
SDL=1;
delay();
SDL=0;
delay();
}
uint8 IIC_read()
{
uint8 k,k1=0x00;
for(k=0;k