What is meaning of this line Data <<= 1 ? I don't understand what is meaning of this line in program ?
C:
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;
}
}
}
Example of Bitwise Logic Operator
Bitwise NOT : Reverses each bit in its operand.
For example:- A = ~ A
00110110 = ~11001001
Bitwise AND : If either or both bits are 0, the result is 0.
For example:- C = A & B
11001001 & 10011011 = 10001001
Bitwise OR : If either or both bits are 1, the result is 1.
For example:- C = A I B
11001001 | 10011011 = 11011011
Example of Bitwise Shift Operator
Bitwise left shift For Example :- 11001001 << 1 = 10010011
Bitwise right shift For Example :-11001001 >> 1 = 11100100
Note : I have edited code
Last edited: