deexith hasan
New Member
I can able to understand transmitting data through I2C..but in receiving data its tough
for me..
in this website i can see 2 SCL and SDA
https://www.robot-electronics.co.uk/acat.../I2C_Tutorial.html
for me..
in this website i can see 2 SCL and SDA
https://www.robot-electronics.co.uk/acat.../I2C_Tutorial.html
C:
unsigned char i2c_rx(char ack)
{
char x, d=0;
SDA = 1;
for(x=0; x<8; x++) {
d <<= 1;
do {
SCL = 1;
}
while(SCL_IN==0); // wait for any SCL clock stretching
i2c_dly();
if(SDA_IN) d |= 1;
SCL = 0;
}
if(ack) SDA = 0;
else SDA = 1;
SCL = 1;
i2c_dly(); // send (N)ACK bit
SCL = 0;
SDA = 1;
return d;
}
in this program where i cant find any digitalread.....
Last edited by a moderator: