#define SETSCL() (PAout(4) = 1) //output push-pull
#define CLRSCL() (PAout(4) = 0)
#define SETSDA() (PAout(5) = 1) //output push-pull
#define CLRSDA() (PAout(5) = 0)
#define CHECKSDA() (PAin(6)) //input
void Delay10us(unsigned int dly)
{
while(dly--);
{
}
}
void IICStart(void)
{
uint8 i;
for(i = 0; i < 2; i++)
Delay10us(100);
SETSDA();
i = 100;
while(i--);
SETSCL();
i = 100;
while(i--);
CLRSDA();
Delay10us(5);
CLRSCL();
Delay10us(5);
}
main()
{
IICStart(); // ok
...
IICStart();// always collapse . change A port to B,c ,d ,e .ok
}
// ????? |