Siemens SIMATIC S7-200 System Manual page 146

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

S7-200 Programmable Controller System Manual
Example: High-Speed Counter Instruction
M
A
I
N
S
B
R
0
I
N
T
0
132
Network 1
//On the first scan, call SBR_0.
LD
SM0.1
CALL
SBR_0
Network 1
//On the first scan, configure HSC1:
//1. Enable the counter.
//
- - Write a new current value.
//
- - Write a new preset value.
//
- - Set the initial direction to count up.
//
- - Select the start and reset inputs
//
to be active high.
//
- - Select 4x mode.
//2. Configure HSC1 for quadrature mode
//
with reset and start inputs.
//3. Clear the current value of HSC1.
//4. Set the HSC1 preset value to 50.
//5. When HSC1 current value = preset value,
//
attach event 13 to interrupt routine INT_0.
//6. Global interrupt enable.
//7. Program HSC1.
LD
SM0.1
MOVB
16#F8, SMB47
HDEF
1, 11
MOVD
+0, SMD48
MOVD
+50, SMD52
ATCH
INT_0, 13
ENI
HSC
1
Network 1
//Program HSC1:
//1. Clear the current value of HSC1.
//2. Select to write only a new current
//
and leave HSC1 enabled.
LD
SM0.0
MOVD
+0, SMD48
MOVB
16#C0, SMB47
HSC
1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents