hi,
im trying to bit-bang i2c...
here's part of my code for checking the line on the port..
BYTE is an unsigned char
void SDA_Write()
{ P2DIR |= DATABIT; }
short isSDA_Low()
{
SDA_Read(); BYTE incoming;
incoming = P2IN & DATABIT;
if (incoming == 0x00)
return 1;
else
return 0;
//return ( ((P2IN & DATABIT) == 0x00) ? 1 : 0 );
}
short isSCL_High()
{
SCL_Read(); BYTE incoming;
incoming = P2IN & CLKBIT;
if (incoming == CLKBIT)
return 1;
else
return 0;
//return ( ((P2IN & CLKBIT) == CLKBIT) ? 1 : 0 );
}
is this correct.....???
if this is not enough to figure out..
plz tell me and ill put in the entire code...
thanks,
karan
CM II
Resolution Systems Inc.