Rockwell Automation 5370-UPK CVIM USER-PAK Option User Manual
Page 85

Chapter 8
Defining Strings for Serial Ports and Viewports
8–9
Serial Ports: You can use the formula indicator with the character code
indicator (see “/ Character Code Indicator”).
Example – Use formulas and formula indicators to transmit a window result
in 16–bit binary code.
Definition of formula 1:
WIN1 / 256
(Window 1 results
256)
Definition of formula 1:
WIN1 % 256
(Window 1 modulo 256)
For a window 1 result of 780:
Formula 1 = 3 (decimal portion disregarded)
Formula 2 = 12
This code
transmits these two bytes (shown in binary below):
/%1 /%2
0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0
Viewports: You can use the %
fn
code in your string text coding in a variety
of ways – as the numeric part of the character code (see “/ Character Code
Indicator”), as a parameter in drawing a line or placing text (see “Draw Line
Codes” and/or “Plot Line Codes”), or as a parameter for color coding (see
“Change Color Codes”). Refer also to “Text and Tool Viewport Examples”
for an example of using the formula indicator.
You can add the “–” (minus) sign as a prefix (as in
–
%
5
) to the formula
indicator, in order to use the negative of the specified formula result value
(this can be practical, for instance, if you are using a formula result as a
parameter in drawing or plotting a line).
# (Index) Character
The
#
(index) character is intended to be used along with the
Repeat String
feature (see also
Repeat String
later in this chapter). When the
#
is placed
in the string text, the CVIM module replaces the
#
in the output with the
current index value.
You can use the # (index) character in two ways:
•
Place the # in the string to take the place of the tool number designation in
a data code – for example, G#, or W#.
•
Place the # by itself in the string to transmit or display the current index
number.
You can, at your option, specify the format of the index “field” in the output.
You specify the index field format by including an optional formatting code
in parentheses immediately following the index character in the text string
you are defining (see “Field Format Codes”).
Using an Offset with the # (Index) Character – You can include an
“offset” with the index character, by placing either the “+” or “–” sign after
the “#,” followed by the offset value.