Swap Byte Order; Converting Unpacked Ascii To Packed Ascii - Spectrum Controls 1769sc-IF4IH User Manual

Compact i/o isolated hart analog module
Table of Contents

Advertisement

Figure 8-3 (Change Byte Order)
User' s Manual 0300215-03 Rev. A

8.1.2 Swap Byte Order

This ladder sample demonstrates how to reverse the order of the bytes for a floating point
tag and then convert it to 4 consecutive SINT tags, so that it can be used in a HART
message.
If the HART message being sent or received using the pass-through
command contains floating point values, the order of the bytes must be
!
reversed.
Attention

8.1.3 Converting Unpacked ASCII to Packed 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.
Construction of Packed ASCII characters:
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.
Chapter 8: Programming Examples
8-3

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 1769sc-IF4IH and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents