USER’S MANUAL 11-1
11: BINARY ARITHMETIC INSTRUCTIONS
Introduction
The binary arithmetic instructions make it possible for the user to program computations using addition, subtraction, mul-
tiplication, and division. For addition and subtraction operands, internal relay M303 is used to carry or to borrow.
31 ADD (Addition)
32 SUB (Subtraction)
33 MUL (Multiplication)
34 DIV (Division)
Key Operation
Press the ADV key, followed by the advanced instruction number.
Valid Operands (Standard Processing)
In the high-speed processing mode, operands for advanced instructions are limited. See page 6-1.
When T (timer) or C (counter) is used as S1 or S2, the timer/counter current value is read out. When T (timer) or C
(counter) is used as D1, the data is written in as a preset value which can be 0 through 9999.
Note: When using the timer or counter as destination, make sure that the data does not exceed the maximum preset value
of 9999. When the preset value exceeds 9999, a user program execution error will result, turning on error indicator ERR1
and special internal relay M304. When a user program execution error occurs, the result is not set to the destination.
Since the binary arithmetic instructions are executed in each scan while input is on, a pulse input from an SOTU or SOTD
instruction should be used as required.
Operand Function I Q M T C R D Constant Repeat
S1 (Source 1) Data for calculation 0-35 0-31 0-317 0-31 0-31 0-63 0-99 0-65535 1-31
S2 (Source 2) Data for calculation 0-35 0-31 0-317 0-31 0-31 0-63 0-99 0-65535 1-31
D1 (Destination 1) Destination to store results — 0-31 0-287 0-31 0-31 0-63 0-99 — 1-31
ADD S1(R)
*****
REP
**
D1(R)
****
S1 + S2 → D1, CY
When input is on, 16-bit word data designated by source operands
S1 and S2 are added. The result is set to destination operand D1
and carry (M303).
S2(R)
*****
SUB S1(R)
*****
REP
**
D1(R)
****
S2(R)
*****
S1 – S2 → D1, BW
When input is on, 16-bit word data designated by source operand
S2 is subtracted from 16-bit word data designated by source oper-
and S1. The result is set to destination operand D1 and borrow
(M303).
MUL S1(R)
*****
REP
**
D1(R)
****
S1 × S2 → D1
When input is on, 16-bit word data designated by source operand
S1 is multiplied by 16-bit word data designated by source operand
S2. The result is set to destination operand D1.
When the result exceeds 65535, error indicator ERR1 and special
internal relay M304 (user program execution error) are turned on.
S2(R)
*****
DIV S1(R)
*****
REP
**
D1(R)
****
S1 ÷ S2 → D1 (quotient), D1+1 (remainder)
When input is on, 16-bit word data designated by source operand
S1 is divided by 16-bit word data designated by source operand
S2. The quotient is set to destination operand D1, and the remain-
der is set to D1+1.
When S2 is 0 (dividing by 0), error indicator ERR1 and special
internal relay M304 (user program execution error) are turned on.
S2(R)
*****
ADV
1
BPS
1 S1
ADD S2:
(+) D1:
3
BPP
Enter operands S1, S2, and D1.
When repeat is required, press the REP key for the operand
to repeat, and enter the number of repeat cycles.
To exit, press the key.