Hello
I need help to understand this function. This function is use to send 8 bit serial data (8051 MCU, embedded c, I2C)
what is meaning of this line if ((Data & 0x80) == 0) ?
I need help to understand this function. This function is use to send 8 bit serial data (8051 MCU, embedded c, I2C)
Code:
unsigned char I2CSend(unsigned char Data)
{
unsigned char i, ack_bit;
for (i = 0; i < 8; i++) {
if ((Data & 0x80) == 0)
SDA = 0;
else
SDA = 1;
SCL = 1;
SCL = 0;
Data<<=1;
}
SDA = 1;
SCL = 1;
ack_bit = SDA;
SCL = 0;
return ack_bit;
}