Program instructions
7.6 Counters
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
275
Example: Updating the current and preset values
LAD
STL
MAIN program network
Update the current count to
1000 and the preset value to
2000 for HSC0 when I2.0
transitions from OFF to ON.
Network 1
LD I2.0
EU
MOVD 1000, SMD38
MOVD 2000, SMD42
= SM37.5
= SM37.6
HSC 0
Attaching HSC interrupt routines in your program
All high-speed counter modes support an interrupt event when the current value of the HSC
is equal to the loaded preset value. Counter modes that use an external reset input support
an interrupt on activation of the external reset. All counter modes except modes 0 and 1
support an interrupt on a change in counting direction. Each of these interrupt conditions can
be enabled or disabled separately. For a complete discussion on the use of interrupts, see
the section about Interrupt instructions (Page 322).