5-9
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
5.6 Increment and Decrement Instructions
Increment Word, Decrement Word
The Increment Word and Decrement Word instructions add or
subtract 1 to or from the input word.
Operands: IN: T, C, MW
OUT: T, C, MW
In ladder: IN + 1 = OUT
IN - 1 = OUT
In STL: OUT + 1 = OUT
OUT - 1 = OUT
Increment and decrement word operations are signed
(16#7FFF > 16#8000).
When programming in ladder, if you specify the address for IN
to be the same address as OUT, you can reduce the amount of
memory required.
These instructions affect the following Special Memory bits:
SM1.0 (zero); SM1.1 (overflow); SM1.2 (negative)
Increment, Decrement Example
LAD STL
Network
LD I0.0
INCW MW0
DECW MW2
INC_W
EN
INMW0 OUT
MW0
DEC_W
EN
INMW2 OUT MW2
125
increment
MW0
MW0
5000
4999
Application
decrement
MW2
MW2
I0.0
Increment Word Decrement Word
126
Figure 5-6 Example of Increment/Decrement Instructions
Instruction Set
L
A
D
S
T
L
INCW OUT
DECW OUT
INC_W
EN
IN OUT
DEC_W
EN
IN OUT