Question
bit shift >> and & operation
Hi i m coding function to write 8 bit data to a slave device, what does the (byte & 0x01) do in the for loop and what does the shift right statement ( byte = byte >> 1;) do ?
void write8bit(uint8_t byte)
{
int i;
for (i = 0; i<8; i++)
{
lowClk();
if (byte & 0x01)
{
Data_HI();
}
else
{
Data_Lo();
}
Delay(3);
byte = byte >> 1;
HiClk();
Delay(3);
}
}