311
Special Math Instructions Section 5-22
5-22-4 SUM – SUM(––)
Limitations This instruction is available in the CQM1 only.
The 3 rightmost digits of C must be BCD between 001 and 999.
DM 6143 to DM 6655 cannot be used for D.
If bit 14 of C is OFF (setting for BCD data), all data within the range R
1
to
R
1
+N–1 must be BCD.
Description When the execution condition is OFF, SUM(––) is not executed. When the
execution condition is ON, SUM(––) adds either the contents of words R
1
to
R
1
+N–1 or the bytes in words R
1
to R
1
+N/2–1 and outputs that value to the
destination words (D and D+1). The data can be summed as binary or BCD
and will be output in the same form. Binary data can be either signed or
unsigned.
The function of bits in C are shown in the following diagram and explained in
more detail below.
Number of Items in Range The number of items within the range (N) is contained in the 3 rightmost digits
of C, which must be BCD between 001 and 999. This number will indicate the
number of words or the number of bytes depending the items being summed.
C: Control data
IR, SR, AR, DM, HR, LR, #
R
1
: First word in range
IR, SR, AR, DM, HR, TC, LR
Ladder Symbols
Operand Data Areas
D: First destination word
IR, SR, AR, DM, HR, LR
SUM(––)
C
R
1
D
@SUM(––)
C
R
1
D
15 14 13 12 11 00
Number of items in range (N, BCD)
Number of words or number of bytes
001 to 999
First byte (when bit 13 is ON)
1 (ON): Rightmost
0 (OFF): Leftmost
Addition units
1 (ON): Bytes
0 (OFF): Words
C:
Data type
1 (ON): Binary
0 (OFF): BCD
Data type
1 (ON): Signed binary
0 (OFF): Unsigned binary