Siemens Simatic S7-200 System Manual page 224

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

Advertisement

Instruction Set
High-Speed Counter Example
Network 1
SM0.1
Network 2
Network 3
0
SBR
Network 4
SM0.0
16#F8
11
50
13
Network 5
Network 6
0
INT
Network 7
SM0.0
16#C0
Network 8
Figure 10-16
10-36
LAD
On the first scan, call
0
subroutine 0.
CALL
End of main program.
END
Start of subroutine 0.
Enable the counter.
Write a new current value.
MOV_B
Write a new preset value.
EN
Set initial direction to count
up. Set start and reset
IN
OUT
SMB47
inputs to be active high.
HDEF
Set 4x mode.
EN
HSC1 configured for
1
HSC
quadrature mode with
MODE
reset and start inputs.
MOV_DW
Clear the current value of
EN
HSC1.
0
IN
OUT
SMD48
MOV_DW
Set HSC1 preset value to 50.
EN
IN
OUT
SMD52
ATCH
HSC 1 current value = preset
EN
value (EVENT 13) attached
0
INT
to interrupt routine 0.
EVENT
Global interrupt enable.
ENI
HSC
Program HSC1.
EN
1
N
Terminate subroutine.
RET
Start of interrupt 0.
MOV_DW
Clear the current value
of HSC1.
EN
0
IN
OUT
SMD48
MOV_B
Write a new current value
EN
and enable the counter.
IN
OUT
SMB47
HSC
Program HSC1.
EN
1
N
Terminate interrupt routine.
RETI
Example of Initialization of HSC1
STL
Network 1
LD
SM0.1
CALL
0
Network 2
MEND
Network 3
SBR
0
Network 4
LD
SM0.0
MOVB
16#F8, SMB47
HDEF
1, 11
MOVD
0, SMD48
MOVD
50, SMD52
ATCH
0, 13
ENI
HSC
1
Network 5
RET
Network 6
INT
0
Network 7
LD
SM 0.0
MOVD
0, SMD48
MOVB
16#C0, SMB47
HSC
1
Network 8
RETI
S7-200 Programmable Controller System Manual
C79000-G7076-C230-02

Advertisement

Table of Contents
loading

Table of Contents