S7-200 Programmable Controller System Manual
Increment and Decrement Instructions
Increment
IN + 1 = OUT
OUT + 1 = OUT
Decrement
IN -- 1 = OUT
OUT -- 1 = OUT
The Increment and Decrement instructions add or subtract
1 to or from the input IN and place the result into the
variable OUT.
Increment Byte (INCB) and Decrement Byte (DECB)
operations are unsigned.
Increment Word (INCW) and Decrement Word (DECW)
operations are signed.
Increment Double Word (INCD) and Decrement Double
Word (DECD) operations are signed.
Error conditions that set ENO = 0:
H SM1.1 (overflow)
H 0006 (indirect address)
Special Memory bits affected:
H SM1.0 (zero)
H SM1.1 (overflow)
H SM1.2 (negative) for Word and Double Word operations
Table 6-42
Valid Operands for the Increment and Decrement Instructions
Inputs/Outputs
IN
OUT
Example: Increment and Decrement Instructions
144
LAD and FBD
STL
LAD and FBD
STL
Data Types
Operands
BYTE
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
INT
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC, Constant
DINT
ID, QD, VD, MD, SMD, SD, LD, AC, HC, *VD, *LD, *AC, Constant
BYTE
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *AC, *LD
INT
IW, QW, VW, MW, SMW, SW, T, C, LW, AC,*VD, *LD, *AC
DINT
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC
Network 1
LD
INCW
DECD
Increment Word
Decrement Double Word
I4.0
AC0
VD100
125 + 1 =
AC0
128000 - - 1 =
VD100
126
AC0
127999
VD100