Download Programmable Controller PROGRAMMING MANUAL

Transcript
Section 7-21
BCD Calculation Instructions
Address
Instruction
00000
00001
00002
00003
LD
OUT
CLC(41)
@SUB(31)
Operands
00002
0
TR
DM
HR
00004
00005
00006
00007
00008
00009
00010
00011
AND
CLC(41)
@SUB(31)
LD
LD
OR
AND LD
OUT
#
HR
HR
TR
HR
HR
201
0100
10
25504
0000
10
10
0
25504
1100
--1100
The first and second subtractions for this diagram are shown below using example data for 201 and DM 0100.
Note The actual SUB(31) operation involves subtracting Su and CY from 10,000 plus
Mi. For positive results the leftmost digit is truncated. For negative results the
10s complement is obtained. The procedure for establishing the correct answer
is given below.
First Subtraction
IR 201
1029
DM 0100 – 3452
CY
–0
HR 10
7577 (1029 + (10000 – 3452))
CY
1
(negative result)
Second Subtraction
0000
HR 10 –7577
CY
–0
HR 10 2423 (0000 + (10000 – 7577))
CY
1
(negative result)
In the above case, the program would turn ON HR 1100 to indicate that the value
held in HR 10 is negative.
7-21-5 BCD MULTIPLY – MUL(32)
Operand Data Areas
Md: Multiplicand (BCD)
Ladder Symbols
IR, SR, AR, DM, HR, TC, LR, #
MUL(32)
@MUL(32)
Md
Md
Mr
Mr
R
R
Mr: Multiplier (BCD)
Limitations
430
DM 6144 to DM 6655 cannot be used for R.
IR, SR, AR, DM, HR, TC, LR, #
R: First result word
IR, SR, AR, DM, HR LR