January 2012 8.15 Command Set 1705
8.15.43 ADDITION [ ] (+[ ])
Syntax: +[ ] (PLUS[ ])
Operands: None
Action:
Use parentheses together with arithmetical commands only for word
processing. By using parentheses you can change the sequence of processing
in a statement list. The opening-parenthesis command puts the content of the
word accumulator onto the program stack. This clears the accumulator for
calculation of intermediate results. The closing-parenthesis command gates
the buffered value from the program stack with the content of the word
accumulator. The control saves the result in the accumulator again. Maximum
nesting depth: 16 parentheses. If an error occurs during calculation, the
control sets the marker M4201.
Example:
Example for the commands ADD [ ], SUBTRACT [ ], MULTIPLY [ ], DIVIDE [ ],
REMAINDER [ ].
Divide a constant by double word D36, add the result to double word D12, and
assign the result to double word D100.
Initial state:
Constant = 1000 (dec)
Double word D12 = 15000 (dec)
Double word D36 = 100 (dec)
Double word D100 = ?
Function STL Accumulator
content
Operand content
Load the double word
D12 into the word
accumulator.
L D12 15000 15000
Opening parenthesis:
Buffer the accumulator
content onto the program
stack.
+[
Load the constant K1000
into the word
accumulator.
L K1000 1000
Divide the word
accumulator by the
content of the double
word D36.
/ D36 10 100
Closing parenthesis: Gate
the accumulator content
with the program stack
(+[, –[ .....).
]
Assign the result of the
total operation to double
word D100.
= D100 15010 15010