![Geometrics G-824A Operation Manual Download Page 44](http://html1.mh-extra.com/html/geometrics/g-824a/g-824a_operation-manual_2214704044.webp)
Geometrics, Inc. G-824A Magnetometer Manual
40
it is outputting data, or there is a problem with cycle timing with the magnetometer's Larmor
counter. Outputting all five bytes of the status number will enable the user to distinguish
between the error messages in the event of a problem but may not be possible at the highest
sample rates.
7.4 XS3 Data Output Format
XS3 is an industry-standard data decoding system that permits two decimal characters to be
packed into one ASCII byte, doubling the amount of data that can be sent to the host
computer by the G-824A. This is an important feature as it helps address the limitation of
the magnetometer's 115,200 baud rate when outputting data at the full 1000 readings per
second. XS3 is similar to Packed BCD but each byte has 03 HEX subtracted. This results in
data that is entirely printable ASCII characters, which can be examined with a standard text
editor.
The process of converting the XS3 format data into ASCII is explained in following steps:
Step 1. Decode XS3 into digits: each byte of the input data is taken in turn and compared to
the value 0x30. If it is less that 0x30, it does not comprise digits. It may be the "$" that
begins a line, the "*" that ends a line or perhaps an embedded ",".
Step 2. Of those bytes that are 0x30 or more, the upper nibble is the first digit to be made
from this byte. The digit is decoded as upper nibble minus 3. An example of "C" code will
look like this:
Something = (byte >> 4) -3;
If the lower nibble is 3 or more the same process is applied to the lower nibble.
if ( (byte & 0x0f) >= 3) {
Something = (byte & 0x0f) -3;
......
}
else {
/* nothing to do no digit here */
}
Applying this decoding process to every byte of the data that is 0x30 or more will produce
an output of a string of digits.
Step 3. The next step is to insert the decimal points and commas (or spaces) as required.
For this example, a decimal point needs to be inserted after 5 digits and, if required, commas
after 10 and 12 digits.
$123456789012*
becomes