beautypg.com

Spectrum Controls 1769sc-HART Modules User Manual

Page 120

background image

Compact IO™ Isolated HART Analog Input Module

User's Manual 0300215-03 Rev. A

8-4

The algorithm can be implemented in ladder by masking and shifting four 6-bit
characters into a double word register then moving the three bytes into the packed ASCII
string.

Reconstruction of ASCII characters:

Unpacking packed ASCII strings requires flipping some bits in addition to
uncompressing the string itself. To unpack a packed ASCII string:

1.

Unpack the four, 6-bit ASCII characters.

2.

For each character, place the complement of bit 5 into bit 6.

3.

For each character, reset bit Bit 7 to zero.

4.

Repeat until the entire string is processed.

This algorithm can be implemented by loading three bytes into a 24-bit register and
shifting the four 6-bit characters into the string. Parse the resulting character to flip bit 6
as needed.

The ladder sample starting on the next page demonstrates how to pack 4 unpacked ASCII
characters into 3 bytes.

Figure 8-4a (Packed ASCII)