Microcontroller › AVR › convery nmea ASCII string into binary › Hi JayEach character in that
January 9, 2017 at 6:18 pm
#14334
GANEEV SINGH
Participant
Hi Jay
Each character in that string represents a single byte and we know that a byte consists of eight bits, so what bit masking means is that you try and extract these bytes bit by bit.
Let us consider an example, let byte be an integer variable storing a single character (ASCII value) of GPS string at a time. Then to apply a bit masking on it will be done somewhat like this:
for(i=0;i<8;i++)
{
if((byte&(1<<i))==1)
pin=1; //High
else
pin=0; //Low
delay(10); //a small delay
}
Here pin is a source for FSK modulator with bit values. This fashion transmits lowest significant bit first.
Hope this helps