Hi,
I am working through some code and confused about what this means and how it works.
What is the meaning of if (c & 0x80). I thought if the serial received was equal to 128, then process the buffer, however that does not seem to be the case.
This is an example of the values printed out that are received by the serial 4 64 0 15 127 124 248....and then it will process the data.
I have been reading up on bitwise operators, however I just can't understand what it means (guess I am stuck in logical thought). Any help would be great. Thanks.
I am working through some code and confused about what this means and how it works.
Code:
while(Serial2.available() > 0) {
c = Serial2.read();
buf[bufIndex++] = c;
Serial.println(c);
// Process receive buffer if framing char received
if(c & 0x80) {
Do processing in here}
}
What is the meaning of if (c & 0x80). I thought if the serial received was equal to 128, then process the buffer, however that does not seem to be the case.
This is an example of the values printed out that are received by the serial 4 64 0 15 127 124 248....and then it will process the data.
I have been reading up on bitwise operators, however I just can't understand what it means (guess I am stuck in logical thought). Any help would be great. Thanks.