Spectrum Controls 1756sc-OF8H Series A User Manual
Page 130
116
ControlLogix
™
Analog HART Modules
C o n
C o n
C o n
C o n
C o n vvvvv e r
e r
e r
e r
e r t i n g
t i n g
t i n g
t i n g
t i n g
Unpac
Unpac
Unpac
Unpac
Unpackkkkked
ed
ed
ed
ed ASCII
ASCII
ASCII
ASCII
ASCII
to P
to P
to P
to P
to Pac
ac
ac
ac
ackkkkked
ed
ed
ed
ed ASCII
ASCII
ASCII
ASCII
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.
Constr
Constr
Constr
Constr
Construction of
uction of
uction of
uction of
uction of P
P
P
P
Pac
ac
ac
ac
ackkkkked
ed
ed
ed
ed ASCII c
ASCII c
ASCII c
ASCII c
ASCII char
har
har
har
haracter
acter
acter
acter
acters:
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.
R
R
R
R
Reconstr
econstr
econstr
econstr
econstr uction of
uction of
uction of
uction of
uction of ASCII c
ASCII c
ASCII c
ASCII c
ASCII char
har
har
har
haracter
acter
acter
acter
acters:
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.