6ć16, 6 bcd to binary conversion – Rockwell Automation 1772-LP3 PLC - 2/30 Programmable Controller Programming and Operations Manual User Manual
Page 138
Data Manipulation Instructions
Chapter 6
6Ć16
Table 6.B
Arithmetic Instructions
NOTE: Arithmetic instructions operate on BCD values in the Data Table. The word address XXX is displayed above the instruction; the BCD value
YYY, which is the result of the arithmetic operation, is displayed beneath it. The BCD value is stored in the lower 12 bits of the word address and they
can be any value from 000 to 999.
Displayed word addresses will be 3, 4, or 5 digits depending on the Data Table size. When entering the word address, use a leading zero if necessary.
Keytop Symbol
Instruction Name
1770ĆT3 Display
Description
-( + )-
ADD
ăXXX
-( + )-
ăYYY
The ADD instruction is an output instruction. It is always
preceded by two GET instructions which store the BCD
values to be added.
When the sum exceeds 999, bit 14 is set to 1. A 1 is
displayed in front of the result, YYY. See Note.
-( - )-
SUBTRACT
ăXXX
-( - )-
ăYYY
The SUBTRACT instruction is an output instruction. It is
always preceded by two GET instructions. The value in
the second GET address is subtracted from the value in
the first.
When the difference is negative, bit 16 is set to 1 and a
minus sign is displayed in front of the result, YYY. See
Note.
-( X )-
MULTIPLY
ăXXX ăXXX
-( X )- -( X )-
ăYYY ăYYY
The MULTIPLY instruction is an output instruction. It is
always preceded by two GET instructions which store the
values to be multiplied. See Note.
Two word addresses are required to store the 6Ćdigit
product.
-(
÷
)-
DIVIDE
ăXXX ĂăXXX
-( : )- Ă-( : )-
ăYYY .ăYYY
The DIVIDE instruction is an output instruction. It is always
preceded by two GET instructions. The value of the first is
divided by the value of the second.
Two word addresses are required to store the 6Ćdigit
quotient. Its decimal point is placed automatically by the
Industrial Terminal.
Important: This note applies to BCD to Binary and Binary to BCD
conversions.
A BCD-to-Binary or Binary-to-BCD conversion is performed on the
lower twelve bits of a word. The upper four bits are not involved with the
conversion and are not transferred. You must create a user program to
monitor the upper four bits as required by your application.
This output instruction will convert a BCD number (from 0-4095) into a
12-bit binary number on a true rung decision. The BCD number is stored
in two consecutive data table locations as two three-digit BCD integers.
The first word contains the most significant digit (not > 004) and the
second word contains the three least significant digits. While the rung is
true, if the BCD value changes, the binary value will also change.
6.6
BCD to Binary Conversion