11: BINARY ARITHMETIC INSTRUCTIONS
OPENNET CONTROLLER USER’S MANUAL 11-9
INC (Increment)
DEC (Decrement)
Valid Operands
For the valid operand number range, see page 6-2.
Since the INC and DEC instructions are executed in each scan while input is on, a pulse input from a SOTU or SOTD
instruction should be used as required.
Valid Data Types
When a word operand such as D (data register) or L (link register) is designated as the source/destination, 1 point (word
data type) or 2 points (double-word data type) are used.
Increment beyond Limits
In the word data type, valid values are 0 to 65535. If the designated operand is currently 65535, the value will become 0
after it is incremented by one. The carry (M8003) is not set by this operation.
In the double-word data type, valid values are 0 to 4,294,967,295. If the designated operand is currently 4,294,967,295, the
value will become 0 after it is incremented by one. The carry (M8003) is not set by this operation.
Decrement beyond Limits
In the word data type, valid values are 0 to 65535. If the designated operand is currently 0, the value will become 65535
after it is decremented by one. The borrow (M8003) is not set by this operation.
In the double-word data type, valid values are 0 to 4,294,967,295. If the designated operand is currently 0, the value will
become 4,294,967,295 after it is decremented by one. The borrow (M8003) is not set by this operation.
Example: INC
Example: DEC
Operand Function I Q M R T C D L Constant Repeat
S/D (Source/Destination) Operand to increment data —————— XX ——
W (word) I (integer) D (double word) L (long)
X — X —
S/D + 1 → S/D
When input is on, one is added to the value in the operand and the new value is stored to
the same operand.
INC(*) S/D
*****
S/D – 1 → S/D
When input is on, one is subtracted from the value in the operand and the new value is
stored to the same operand.
DEC(*) S/D
*****
S/D
D10
When input I0 is turned on, the data of D10 is incremented by one.
If the SOTU is not programmed, the data of D10 is incremented in each scan.
I0
INC(W)
SOTU
100
D10
+
101
D101
S/D
D20
I1
DEC(W)
SOTU
When input I1 is turned on, the data of D20 is decremented by one.
If the SOTU is not programmed, the data of D20 is decremented in each scan.
100
D20
–
99
D201
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com