Field formatting codes – Rockwell Automation 5370-UPK CVIM USER-PAK Option User Manual
Page 86
Chapter 8
Defining Strings for Serial Ports and Viewports
8–10
Example – We want to display the statistical mean for gages 1–8. To do this,
we would use the data code for statistical mean value, Sn.3, where n
represents the tool type and number. For this data code, the n values 9–16
indicate gages 1–8.
We could use the following string:
”
Gage
”
#
”
Mean =
”
S #+8 . 3 n
and use the
Repeat String
feature, with
Start
= 1,
End
= 8,
Increment
= 1.
In this string, the term # + 8 is used for the n value in the data code Sn.3:
Data code Sn.3
”
Gage
”
#
”
Mean =
”
S #+8 . 3 n
n= #+8
where
When this string is repeated for index values from 1–8, the n value
#+8
(current index value + 8) indexes through the values 9–16. In this way, eight
strings are displayed, which provide the mean values for gages 1–8:
Gage
1 Mean = 144.560
Gage
2 Mean = 222.666
Field Formatting Codes
You can, at your option, specify the format of the contents of any numerical
field, that is, fields in the displayed or transmitted strings which correspond
either to tool results (or other data), or to the index (#) number. You specify
field format by placing a field formatting code in parentheses immediately
following the data code (or index character) in the string you are defining.
In defining the format, you can simply specify the “field width,” which limits
the number of places a field will occupy in the serial message (the default
format is 9 places). Or, you can further define the format by also specifying
other characteristics, such as limiting the number of decimal places used (for
floating point results only), or specifying left justification of data within the
field.
For instance, within a serial port string, the data code
G1
will transmit the
result of the gage 1; the transmitted field will, by default, be 9 places in
width. However, entering the code
G1(3)
, where
(3)
is the format code,
transmits the result of the gage 1, and limits the field for that result to three
places in the serial message.
Likewise, within a viewport string, the data code
G1
will display the result of
the gage 1; the displayed field will, by default, be 9 places in width.
However, entering the code
G1(3)
, where
(3)
is the format code, displays