Rockwell Automation 1775-S4B,D17756.5.3 User Manual SCANNER/MSG HND User Manual
Page 92
Formatting Data in Report Generation
Chapter 9
9Ć4
The 1775–S4B scanner displays:
*******2
2
*******2
2
If you specify a field width that is too small for the data, the 1775–S4B
scanner makes room to display the entire expression. No data truncation
occurs.
Specifying a field width is particularly useful for formatting columns of
data. Consider the following example:
If you enter:
P ’LINE1 ’$CACC:0’ ’$CACC:1
P ’LINE2 ’$CACC:3’ ’$CACC:4
P ’LINE3 ’$CACC:5’ ’$CACC:6
In these command lines, $CACC is a logical address which represents a
word location in PLC–3 memory. Suppose the following values print out:
LINE 1 128 4752
LINE 2 5 2839
LINE 3 628 67
As you can see, the columns are not uniform. To straighten the columns,
you can specify a field width.
P ‘LINE1 ’$CACC:0!+05D’ ’$CACC:1
P ‘LINE2 ’$CACC:3!+05D’ ’$CACC:4
P ‘LINE3 ’$CACC:5!+05D’ ’$CACC:6
Now the following would print out:
LINE 1 00128 04572
LINE 2 00005 02839
LINE 3 00628 00067
By specifying a field width of 5, the 1775–S4B scanner makes the printout
for all the values the same size. In the format statements, we specified 0 as
the fill character. So the 1775–S4B scanner fills any extra space with zeros.
Also, you may notice that we specified the format once per line. The last
format specified on a command line becomes the default format for the rest
of the line. The D which ends the format specification defines the base for
the format. We discuss formatting bases in the next section.