Rockwell Automation 1775-S5_SR5,D17756.5.5 User Manual PLC-3 FAMILY I/0 User Manual

Page 109

Advertising
background image

Programming DH and DH+

Message Procedures

Chapter 6

6-18

You must enclose the parameter of the function in parentheses. The
parameter can be a/an:

direct numeric value (either decimal or octal)
expression
user symbol
logical address
symbolic address

TO_BCD Function

The TO_BCD function converts its parameter into a binary coded decimal
value that is 32 bits long. For example, the TO_BCD function in
Figure 6.4 stores the number 27 in binary-coded-decimal format in word
12 of the decimal section of memory. After this function executes, word
12 contains the following bit pattern:

0000 0000 0010 0111

FROM_BCD Function

The FROM_BCD function converts its parameter from
binary-coded-decimal format to binary format. The resulting value is 32
bits long. For example, the FROM_BCD function in Figure 6.4 converts
the contents of decimal word 12 from binary coded decimal to a regular
decimal value of 27. After this function executes, the FROM_BCD
function stores the following bit pattern in user symbol COUNT:

0000 0000 0000 0000 0000 0000 0001 1011

Advertising