EasyManua.ls Logo

Siemens SIMATIC S7 - Page 283

Siemens SIMATIC S7
866 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Program instructions
7.6 Counters
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
283
Example: high-speed counter instruction
LAD
STL
MAIN
On the first scan, call SBR_0.
Network 1
LD SM0.1
CALL SBR_0
SBR0
On the first scan, configure HSC0:
1. Enable the counter
Write a new current value.
Write a new preset value.
Set the initial direction to
count up.
Select the reset input to be ac-
tive high.
Select 4x mode.
2. Configure HSC0 for AB quadra-
ture phase with reset input.
3. Clear the current value of HSC0.
4. Set the HSC0 preset value to 50.
5. Attach event 12 to interrupt rou-
tine INT_0. The interrupt is exe-
cuted when HSC0 current value =
preset value.
6. Global interrupt enable
7. Configure HSC0.
Network 1
LD SM0.1
MOVB 16#F8, SMB37
HDEF 0, 10
MOVD +0, SMD38
MOVD +50, SMD42
ATCH INT_0, 12
ENI
HSC 0

Table of Contents

Other manuals for Siemens SIMATIC S7

Related product manuals