IDEC FC4A-C10R2 User Manual page 238

Fc4a series microsmart micro programmable logic controller
Table of Contents

Advertisement

11: B
A
INARY
RITHMETIC
Repeat Operation in the DIV Instruction
Since the DIV (division) instruction uses two destination operands, the quotient and remainder are stored as described
below. Source operands S1 and S2 and destination operand D1 can be designated to repeat individually or in combination.
When destination operand D1 is not designated to repeat, the final result is set to destination operand D1 (quotient) and
D1+1 (remainder). When repeat is designated, consecutive operands as many as the repeat cycles starting with the desig-
nated operand are used.
Since the repeat operation works similarly on the word and integer data types, the following examples are described using
the word data type.
Repeat One Source Operand
When only S1 (source) is designated to repeat, the final result is set to destination operands D1 and D1+1.
DIV(W)
SOTU
I1
Repeat Destination Operand Only
When only D1 (destination) is designated to repeat, the same result is set to 6 operands starting with D1.
DIV(W)
SOTU
I1
Repeat Two Source Operands
When S1 and S2 (source) are designated to repeat, the final result is set to destination operands D1 and D1+1.
DIV(W)
SOTU
I1
Repeat Source and Destination Operands
When S1 (source) and D1 (destination) are designated to repeat, different results are set to 6 operands starting with D1.
DIV(W)
SOTU
I1
Repeat All Source and Destination Operands
When all operands are designated to repeat, different results are set to 6 operands starting with D1.
DIV(W)
SOTU
I1
Note: When a user program execution error occurs in any repeat operation, special internal relay M8004 (user program exe-
cution error) and the ERR LED are turned on and maintained while operation for other instructions is continued.
11-6
I
NSTRUCTIONS
S1 R
S2 –
D1 –
D10
D20
D30
S1 –
S2 –
D1 R
D10
D20
D30
S1 R
S2 R
D1 –
D10
D20
D30
S1 R
S2 –
D1 R
D10
D20
D30
S1 R
S2 R
D1 R
D10
D20
D30
« FC4A M
ICRO
S1 (Repeat = 3)
REP
D10
3
D11
D12
S1 (Repeat = 0)
REP
D10
3
D10
D10
S1 (Repeat = 3)
REP
D10
3
D11
D12
S1 (Repeat = 3)
REP
D10
3
D11
D12
S1 (Repeat = 3)
REP
D10
3
D11
D12
S
U
'
M
»
MART
SER
S
ANUAL
S2 (Repeat = 0)
÷
D20
(D30)
÷
D20
(D30)
÷
D20
Quotient Remainder
S2 (Repeat = 0)
÷
D20
÷
D20
÷
D20
Quotient Remainder
S2 (Repeat = 3)
÷
D20
(D30)
÷
D21
(D30)
÷
D22
Quotient Remainder
S2 (Repeat = 0)
÷
D20
÷
D20
÷
D20
Quotient Remainder
S2 (Repeat = 3)
÷
D20
÷
D21
÷
D22
Quotient Remainder
D1 (Repeat = 0)
(D31)
(D31)
D30
D31
D1 (Repeat = 3)
D30
D33
D31
D34
D32
D35
D1 (Repeat = 0)
(D31)
(D31)
D30
D31
D1 (Repeat = 3)
D30
D33
D31
D34
D32
D35
D1 (Repeat = 3)
D30
D33
D31
D34
D32
D35

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents