11ć5 – Rockwell Automation 1775-S4B,D17756.5.3 User Manual SCANNER/MSG HND User Manual
Page 130

Using Report Generation Functions
Chapter 11
11Ć5
Format conversion functions give you the capability to express values in
binary or binary coded decimal format. Figure 11.2 shows you the
relationship between the two format conversion functions. The format
conversion functions include:
To_bcd
From_bcd
We describe these functions in the following sections.
Figure 11.2
Format Conversion Functions
FROM_BCD
TO_BCD
Binary coded
decimal values
in the data
table.
Binary values
for use in report
generation.
Definition: To convert an expression from 32-bit integer to its BCD
equivalent.
Abbreviation: TO
Format: TO (<expression>)
Description: The to_bcd function accepts an arithmetic value, expression,
which converts to a 32-bit integer. The binary coded decimal equivalent
returns.
Example using the to_bcd function:
If you enter:
$D:0=10
This assignment command line writes a decimal 10 into word zero of the
binary section. Without the to_bcd function, the binary value assigned to
word address D:5 would be:
0000 0000 0000 1010
When interpreted as a BCD value, a non-recognizable value is produced.
11.3
Format Conversion
Functions
11.3.1
To_bcd