Quantcast
Channel: Microcontrollers, Programming and IoT
Viewing all articles
Browse latest Browse all 1271

function to send data

$
0
0
Hello
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;
}
what is meaning of...

function to send data

Viewing all articles
Browse latest Browse all 1271

Trending Articles