Data Output Formats

Tibbit #43-2 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 three 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:

7.931,96.105;7.906,96.129;7.906,96.105;

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. The nominal resolution of this Tibbit is 13 bits (12 bits plus sign), meaning that the nominal measurement "step" of the ADC is 201.14V / 8192 = 0.02455V (for the single-ended mode). However, as its effective resolution is 11 bits (10 bits plus sign), its accuracy is about 201.14V / 2048 = 0.09821.


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 the Tibbit 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) × 100.57V

Negative number (SIGN = 1)

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


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) × 201.14V

Negative number (SIGN = 1)

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


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

05 18 BF 38 05 16 BF 36 05 16 BF 37

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 (from the same inputs as the previous example):

30 35 31 38 2C 42 46 33 38 3B 30 35 31 36 2C 42
46 33 38 3B 30 35 31 36 2C 42 46 33 38 3B
0518,BF38;0516,B
F38;0516,BF38;

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