Instruction Manual

116 ControlLogix
Analog HART Modules
ConCon
ConCon
Con
vv
vv
v
erer
erer
er
tingting
tingting
ting
UnpacUnpac
UnpacUnpac
Unpac
kk
kk
k
ed ed
ed ed
ed
ASCIIASCII
ASCIIASCII
ASCII
to Pto P
to Pto P
to P
acac
acac
ac
kk
kk
k
ed ed
ed ed
ed
ASCIIASCII
ASCIIASCII
ASCII
Packed ASCII is a HART-specific 6-bit character code representing a
subset of the ASCII character code set (see table below). Produced by
compressing four packed ASCII characters into three 8-bit bytes, packed
ASCII strings must be a multiple of 4 characters (3 bytes) and must be
padded out to the end of the data item with space characters. For
example, 4 space characters at the end of a string would appear as the 3
bytes: 0x82, 0x08 and 0x20.
ConstrConstr
ConstrConstr
Constr
uction ofuction of
uction ofuction of
uction of
P P
P P
P
acac
acac
ac
kk
kk
k
ed ed
ed ed
ed
ASCII cASCII c
ASCII cASCII c
ASCII c
harhar
harhar
har
acteracter
acteracter
acter
s:s:
s:s:
s:
Constructing a packed ASCII string is a simple matter of discarding the
most significant two bits from each character and compressing the result:
1) Truncate Bits 6 and 7 of each ASCII character.
2) Pack four, 6 bit-ASCII characters into three bytes.
3) Repeat until the entire string is processed.
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.
RR
RR
R
econstreconstr
econstreconstr
econstr
uction ofuction of
uction ofuction of
uction of
ASCII cASCII c
ASCII cASCII c
ASCII c
harhar
harhar
har
acteracter
acteracter
acter
s:s:
s:s:
s:
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.
Figure 5.6 demonstrates how to pack 4 unpacked ASCII characters into 3
bytes.