212
6 BASIC INSTRUCTIONS
6.2 Arithmetic Operation Instructions
Decrementing 16-bit binary data
DEC(P)(_U)
These instructions subtract 1 from the device (16-bit binary data) specified by (d).
■Descriptions, ranges, and data types
■Applicable devices
• These instructions decrement device (16-bit binary data) specified by (d) by 1.
• If DEC(P) instruction is executed when contents of device specified by (d) is -32768, 32767 is stored in the device specified
by (d). (If signed is specified)
• If DEC(P)_U instruction is executed when contents of device specified by (d) is 0, 65535 is stored in the device specified by
(d). (If unsigned is specified)
• Flags (zero, carry and borrow) are not activated at this time.
Note that data is decremented in every operation cycle in a continuous operation type (DEC) instruction.
There is no operation error.
Ladder diagram Structured text
ENO:=DEC(EN,d);
ENO:=DECP(EN,d);
ENO:=DEC_U(EN,d);
ENO:=DECP_U(EN,d);
Operand Description Range Data type Data type (label)
(d) DEC(P) Device to be decremented by -1 -32768 to +32767 16-bit signed binary ANY16_S
DEC(P)_U 0 to 65535 16-bit unsigned binary ANY16_U
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB
U\G T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U\G Z LC LZ K, H E $
(d)
(d) (d)
5678 (BIN) 5677 (BIN)
-1
b15 b0
···
b15 b0
···