Measurement Computing LogBook Series User Manual
Page 99

LogBook User’s Manual
958396
GPS and Serial Device Data Collection 6-11
One method of parsing the UTC is to create a single channel that parses the entire UTC. In this case, the channel
type would be set to “Sx_Float” and the format string would be set to “$GPGGA,%f”. The value of the channel for
the example line above would be 11855. When parsing the UTC with this method, the channel value can jump
when the minutes or hours change (i.e. 11859 to 11900). In this case, “Sx_Int” cannot be used because the UTC
can be greater than 32767.
Another method to parse the UTC is to create individual hours, minutes, and seconds channels. The hours and
minutes channels would be configured as “Sx_Int” with format strings of “$GPGGA,%2u” and
“$GPGGA,%*2u%2u” respectively. Notice that the hours channel parses the first two characters while the minutes
channel throws the first two characters away by using the assignment suppression character (“*”), and parsing the
next two characters. The second channel would be configured for Sx_Float, so that fractions of seconds could be
read, and would use a format string of “$GPGGA,%*4u%f”. Notice the seconds channel throws away the four
characters that make up the hours and minutes, and parses the remaining characters as a floating point number.
The ASCII value of a single character can be read using the %c format specifier. So the latitude hemisphere
character “N” would be read as a decimal 78 (the ASCII value of N). If the channel type is set to “Sx_Char”, the
value of the channel would be 78 but the LBK1 would display “N”.
The following table demonstrates various ways to parse the information contained in the GGA line.
Format String
Comments
$GPGGA,%f
Converts the UTC to a float. The value may jump when minutes and hours change.
$GPGGA,%2u
Convert UTC hours only.
$GPGGA,%*2u%2u Ignore
UTC hours and convert UTC minutes.
$GPGGA,%*4u%f Ignore
UTC hours and minutes and convert seconds.
$GPGGA,%*f,%f
Ignore UTC time and convert Latitude value. This value is in “ddmm.mm” format.
Channel value may jump when degrees change, and channel resolution may be large.
$GPGGA,%*f,%2u
Ignore UTC time and convert Latitude degrees only.
$GPGGA,%*f,%*2u%f
Ignore UTC time and Latitude degrees, convert floating point minutes.
$GPGGA,%*f,%*f,%c Ignore
UTC and Latitude, convert N/S character. The value will be recorded as
decimal equivalent of the ASCII “N” (XX decimal) or “S” (XX decimal).
$GPGGA,%*f,%*f,%*c,%f
Ignore UTC, Latitude, N/S character, convert Longitude in the format “ddmm.mm”.
$GPGGA,%*f,%*f,%*c,%3u
Ignore UTC, Latitude, N/S character, convert Longitude degrees only.
$GPGGA,%*f,%*f,%*c,%*3u,%f
Ignore UTC, Latitude, N/S character, Longitude degrees, convert floating point
Longitude minutes only.
$GPGGA,%*f,%*f,%*c,%*f,%c
Ignore UTC, Latitude, N/S character, Longitude, convert E/W character. The value
will be recorded as decimal equivalent of the ASCII “E” (XX decimal) or “W” (XX
decimal).
If the serial input data is in fixed length format, the format string can be simplified by throwing a
number of characters away, rather than whole fields. For example, the Longitude Hemisphere
could be parsed using a format string of $GPGGA%*31c%c