11: BINARY ARITHMETIC INSTRUCTIONS
OPENNET CONTROLLER USER’S MANUAL 11-3
• Data Type: Integer
• Data Type: Double Word
• Data Type: Long
Example: SUB
• Data Type: Word
The following example demonstrates the use of special internal relay M8003 to process a borrow.
Examples: MUL
• Data Type: Word
• Data Type: Integer
• Data Type: Double Word
• Data Type: Long
I0
REPS2 –
D20
D1 –
D30
S1 –
D10
ADD(I)
–4
D10
+
–15
D30
–11
D20
I0
REPS2 –
D20
D1 –
D30
S1 –
D10
ADD(D)
+
1957400
D10·D11
4112600
D20·D21
6070000
D30·D31
I0
REPS2 –
D20
D1 –
D30
S1 –
D10
ADD(L)
+
216283
D10·D11
–964355
D20·D21
–748072
D30·D31
I0
SOTU
M8003
D12 – 7000 → D12
To process borrowing so that the number of times
a borrow occurs is subtracted from D13.
When a borrow occurs, D13 is decremented by
one.
REPS2 –
7000
D1 –
D12
S1 –
D12
SUB(W)
REPS2 –
1
D1 –
D13
S1 –
D13
SUB(W)
I1
When input I1 is on, data of D10 is multiplied by data of D20, and
the result is set to D30 and D31.
REPS2 –
D20
D1 –
D30
S1 –
D10
MUL(W)
50
D10
×
60
D20
3000
D30·D31
I1
REPS2 –
D20
D1 –
D30
S1 –
D10
MUL(I)
–50
D10
×
60
D20
–3000
D30·D31
I1
Note: When the result exceeds 4,294,967,295, a user program execution error will result, turning on the ERROR LED and
special internal relay M8004 (user program execution error). The result is not set to the destination operand.
REPS2 –
D20
D1 –
D30
S1 –
D10
MUL(D)
×
100000
D10·D11
5000
D20·D21
500000000
D30·D31
I1
Note: When the result is below –2,147,483,648 or over 2,147,483,647, a user program execution error will result, turning
on the ERROR LED and special internal relay M8004 (user program execution error). The result is not set to the destination
operand.
REPS2 –
D20
D1 –
D30
S1 –
D10
MUL(L)
×
–100000
D10·D11
–5000
D20·D21
500000000
D30·D31
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com