605
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Table Data Processing Instructions
3
SUM
SUM
Applicable Program Areas
Operands
z Operand Specifications
Instruction Mnemonic Variations
Function
code
Function
SUM SUM @SUM 184
Adds the bytes or words in the range and outputs
the result to two words.
Symbol
SUM
Area
Function block
definitions
Block program areas Step program areas Subroutines Interrupt tasks
SFC action or
transition programs
Usage OK OK OK OK OK OK
Operand Description Data type Size
C First control word UDINT 2
R1 First word in range UINT Variable
D First destination word UDINT 2
C: First control word R1: First word in range
D: First destination word
Note C and C+1, all of the words in the calculation range must
be in the same data area.
Area
Word addresses
Indirect DM/EM
addresses
Con-
stants
Registers Flags
Pulse
bits
TR
bits
CIO WR HR AR T C DM EM
@DM
@EM
*DM
*EM
DR IR
Indirect
using IR
TK CF
C
OK OK OK OK OK OK OK OK OK OK
OK
--- --- OK --- --- --- ---R1
---
D
C: First control word
R1: First word in range
D: First destination word
SUM(184)
C
R1
D
15 0
C
15 014
0
C+1
13 12 11
0000 0000 0000
Data type (Effective if bit 14 is 0.)
Data type
Units
Starting byte (Effective if bit 13 is 1.)
0: Unsigned binary data
1: Signed binary data
0: Binary
1: BCD
0: Words
1: Bytes
0: Leftmost byte
1: Rightmost byte
W: Number of words/bytes in range
&1 to &65535 (decimal) or
#0001 to #FFFF (hex)
R1
15 0
---
R1+(W–1)
to
Calculation range
D+1
0
15
D
0
15
The leftmost four digits are stored in D+1 and the rightmost
four digits are stored in D.