Geometrics Inc. G-882 Cesium Marine Magnetometer Page
Packed BCD:
Packed BCD format throws away all commas, decimals, spaces, and the
magnetometer most significant byte ('1' if more than 100,000 nT, or a blank is less
than 100,000nT). The Preamble character is left alone. In addition all numeral
characters (ASCII codes 30 hex through 39 hex) have the upper nibble (always a
3) discarded and two lower nibbles combined to form one byte. Finally, the
carriage return, line feed sequence is replaced with a single terminating
character '*' (2A hex).
It is very difficult to show what these files would look like if displayed on a
computer screen since each type of computer would display these binary
characters differently. Many of these binary characters would be interpreted as
screen commands which might ring the bell or clear the screen. Therefore it is
necessary to convert ASCII printouts to hexadecimal numbers to show the
Packed BCD format.
An ASCII counter output of:
'$ 54369.127,1234,5678,0000'(plus carriage return line feed)
converted to hexadecimal numbers would be:
24 20 35 34 33 36 39 2E 31 32 37 2C 31 32 33 34
2C 35 36 37 38 2C 30 30 30 30 0D 0A
[ '$'= 24, ‘ '= 20, '.'= 2E, ','= 2C, CR/LF = 0D 0A,
'0'-'9'= 3x (where x = number 0-9)]
Note: ‘ ‘ signifies a blank
Using the above definition the same data in packed BCD
output format would be:
24 54 36 91 27 12 34 56 78 00 00 2A
\ \ \ \ \ \___Terminating character ('*')
\ \ \ \ \__analog channel #3 ('0000')
\ \ \ \__analog channel #2 ('5678')
\ \ \__analog channel #1 ('1234')
\ \__Mag reading ('54369.127')
\__Preamble Character ('$')
Note how easy it is to see the numbers if viewing a hex dump of the data.
Remember though that it must be translated to printable characters before
copying the raw data to printers or a CRT screen.