Add (Addition); Sub (Subtraction); Mul (Multiplication); Div (Division) - IDEC FC4A-C10R2 User Manual

Fc4a series microsmart micro programmable logic controller
Table of Contents

Advertisement

11: B
INARY
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 M8003 is used to carry or to borrow.
The ROOT instruction can be used to calculate the square root of the value stored in a data register.

ADD (Addition)

ADD(*)
S1(R)
*****

SUB (Subtraction)

SUB(*)
S1(R)
*****

MUL (Multiplication)

MUL(*)
S1(R)
*****

DIV (Division)

DIV(*)
S1(R)
*****
Applicable CPU Modules
FC4A-C10R2/C
FC4A-C16R2/C
X
A
RITHMETIC
S2(R)
D1(R)
REP
*****
*****
**
S2(R)
D1(R)
REP
*****
*****
**
S2(R)
D1(R)
REP
*****
*****
**
S2(R)
D1(R)
REP
*****
*****
**
FC4A-C24R2/C
X
X
« FC4A M
ICRO
I
NSTRUCTIONS
S1 + S2 → D1, CY
When input is on, 16-bit data designated by source operands S1
and S2 are added. The result is set to destination operand D1
and carry (M8003).
S1 – S2 → D1, BW
When input is on, 16-bit data designated by source operand S2
is subtracted from 16-bit data designated by source operand S1.
The result is set to destination operand D1 and borrow (M8003).
S1 × S2 → D1·D1+1
When input is on, 16-bit data designated by source operand S1
is multiplied by 16-bit data designated by source operand S2.
The result is set to 32-bit data designated by destination oper-
and D1.
S1 ÷ S2 → D1 (quotient), D1+1 (remainder)
When input is on, 16-bit data designated by source operand S1
is divided by 16-bit data designated by source operand S2. The
quotient is set to 16-bit destination operand D1, and the remain-
der is set to the next 16-bit data.
When S2 is 0 (dividing by 0), the ERR LED and special internal
relay M8004 (user program execution error) are turned on.
A user program execution error also occurs in the following divi-
sion operation.
Data type I: –32768 ÷ (–1)
FC4A-D20K3/S3
FC4A-D20RK1/RS1 & FC4A-D40K3/S3
X
S
U
'
M
»
MART
SER
S
ANUAL
X
11-1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents