Data Output Formats

Tibbit #43-1 supports three data output formats: ASCII, binary, and hexadecimal. Which format to use at low sampling rates is solely up to your preferences and needs. However, if you plan to stream the data continuously and at a high sampling rate, Tibbo recommends that you use the binary format — especially if your desired sampling rate is near the maximum limit for the ASCII and hexadecimal modes (see the Specifications).


ASCII Format

When using the ASCII format, the Tibbit's onboard PIC microcontroller calculates the actual voltages corresponding to the binary measurement data received from the ADC and outputs these voltages in a human-readable decimal format. Each number is rounded to four decimal places*.

In the output, channel voltages are separated by a comma (",") and each sampling group ends with a semicolon (";"). The term "sampling group" refers to the group of the currently enabled channels. In the single-ended mode and with all channels enabled, the group will comprise four measurements, performed one after another. If some channels are disabled, each group will have fewer than four measurements.

The following shows a sample output containing three groups with two measurements in each group:

3.2800,-4.2713;3.3120,-4.2600;3.1421,-4.1701;

Note that it is your application's job to remember which channels are enabled, as channel numbers are not printed in this mode. For example, the two members of each group in the output above could be from CH1 and CH2, or CH1 and CH3, or CH1 and CH4 — there is no way to tell this from the output itself.

* This, of course, is not an indicator of the ADC's measurement precision. The value of "1.2345" does not mean that the ADC was able to sample the applied voltage with a 0.0001V accuracy. Since the effective resolution of this Tibbit is 11 bits (10 bits plus sign), the actual measurement "step" of the ADC is 20V / 2048 = 0.0098V (for the single-ended mode).


Binary Format

The binary data output format is the most compact, which is why it is recommended for high sampling rates. The sampling value obtained from an ADC channel, as well as the channel number, are encoded into just 16 bits of data. Bits 15 and 14 encode the channel number, while bits 13-0 contain the result of the ADC conversion. Each 16-bit word is sent as two bytes; the high byte is sent first.

The channel number encoding is as follows:

Table 6 — Channel Number Encoding

Channel

B15

B14

CH1

0

0

CH2

0

1

CH3

1

0

CH4

1

1


The ADC data encoding depends on whether Tibbit #43-1 is running in the single-ended or differential mode, as detailed below:


Single-Ended Mode

Table 7 — Binary Format Single-ended Mode Data Structure

B15

B14

B13

B12

B11

B10

B9

B8

B7

B6

B5

B4

B3

B2

B1

B0

ADC channel

SIGN

Always 0

ADC conversion data without the sign ([D11:0])


The sign bit will be 0 for positive numbers (measurements above 0V) and 1 for negative numbers (measurements below 0V). B12 is always zero.

Use the following formulas to convert the data into corresponding voltage values:

Table 8 — Binary-to-Voltage Conversion Formulas for the Single-Ended Mode

Positive number (SIGN = 0)

Vi = (D[11:0] / 4095) × 10V

Negative number (SIGN = 1)

Vi = -((4095 - D[11:0]) / 4095) × 10V


Differential Mode

Table 9 — Binary Format Differential Mode Data Structure

B15

B14

B13

B12

B11

B10

B9

B8

B7

B6

B5

B4

B3

B2

B1

B0

ADC channel

SIGN

ADC conversion data without the sign ([D12:0])


The sign bit will be 0 for positive numbers (measurements above 0V) and 1 for negative numbers (measurements below 0V).

Use the following formulas to convert the data into corresponding voltage values:

Table 10 — Binary-to-Voltage Conversion Formulas for the Differential Mode

Positive number (SIGN = 0)

Vi = (D[12:0] / 8191) × 20V

Negative number (SIGN = 1)

Vi = -((8191 - D[12:0]) / 8191) × 20V


The following shows a sample "hex dump" output containing three groups with two measurements in each group:

09 9D 66 66 09 9A 66 65 09 9B 66 68

Here is how to interpret this data:


The binary data output format is extremely compact, but care should be taken to avoid losing any data bytes. Although the channel number is encoded in the output, missing a single data byte will result in a permanent "data interpretation shift."  


Hexadecimal (HEX) Format

This format is a hybrid of the ASCII and binary formats:


The following shows a sample "hex dump" output containing three groups with two measurements in each group:

30 39 39 42 2C 36 36 36 41 3B 30 39 39 43 2C 36
099B,666A;099C,6
36 37 32 3B 30 39 39 42 2C 36 36 36 39 3B
672;099B,6669;

The HEX format is a good compromise between the ASCII and binary formats. Like the ASCII format, it allows you to regain synchronization if some characters are missed. Unlike the binary format, it employs printable ASCII characters, which may be desirable. At the same time, the HEX output is a bit more compact than the ASCII one, thus achieving a slightly higher sampling rate than the latter.


Data Output Formats

ASCII Format

Binary Format

Table 6 — Channel Number Encoding

Single-Ended Mode

Table 7 — Binary Format Single-ended Mode Data Structure

Table 8 — Binary-to-Voltage Conversion Formulas for the Single-Ended Mode

Differential Mode

Table 9 — Binary Format Differential Mode Data Structure

Table 10 — Binary-to-Voltage Conversion Formulas for the Differential Mode

Hexadecimal (HEX) Format