I have a radio IC that provides weather message data and also provides a confidence level of each byte of data received. The problem is that the confidence data comes in a little strange and I'm not sure how to rearrange it.
So taking the incoming data bytes and placing them in a string is simple enough, but how do I take the 2 bytes of confidence data coming in and break them up so that I can correlate the confidence bit with the corresponding data bit i.e...Data0/conf0?
The confidence data represents a char number between 0 and 3 for each confidence bit.
int conf7, conf 6, conf5, conf4, //int to store confidence values
No. The values are not ints. They are single bits, so, if you need to store them individually, they should be stored in byte variables, which are half the size.
conf7 = bitRead(confByte, 3); // read left-most bit of confByte0
No. The leftmost bit is bit 7.
It appears that the "confidence bit" is actually two bits, so, you'll need two bitRead()s and two bitWrite()s to get the data, and store it in the low order bits of the byte,
Well, PaulS suggested that I change the size of the array.
I figured I either need to let the array establish its own size as the message comes in or I need to define the max size.
Is there another approach. This is to collect NOAA Weather Radio messages.
No message could be max of 268 bytes not bits. The confidence bits are 2 bits for each of the max 268 bytes and represent a value of 0 to 3 based on quality.