The original code works fine, it is :
for(i = 0; i < 8; i++){
while(readPortAPin1() == BAIXO);
writePortAPin2(value & 0x01);
value >>= 1;
while(readPortAPin1() == ALTO);
}
In the first code, if value = 10101010 it will be sent as 01010101. I would like to change the order of transmission, for example, if value = 10101010, I woul like to transmit 10101010.
To implement this, I did the following code:
for(i = 0; i < 8; i++){
while(readPortAPin1() == BAIXO);
writePortAPin2(value & 0x80);
value <<= 1;
while(readPortAPin1() == ALTO);
}
But, it is not working, it is transmiting all 0s. Am I doing something wrong ?