Initialization Modes 9, 10, Or 11 - Siemens SIMATIC S7-200 System Manual

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

Advertisement

SIMATIC Instructions

Initialization Modes 9, 10, or 11

The following steps describe how to initialize HSC1 for A/B Phase Quadrature
Counter (Modes 9, 10, or 11):
1.
Use the first scan memory bit to call a subroutine in which the initialization
operations are performed. Since you use a subroutine call, subsequent scans
do not make the call to the subroutine, which reduces scan time execution and
provides a more structured program.
2.
In the initialization subroutine, load SMB47 according to the desired control
operation.
For example (1x counting mode):
SMB47 = 16#FC produces the following results:
For example (4x counting mode):
SMB47 = 16#F8 produces the following results:
3.
Execute the HDEF instruction with the HSC input set to 1 and the MODE input
set to 9 for no external reset or start, 10 for external reset and no start, or 11
for both external reset and start.
4.
Load SMD48 (double word size value) with the desired current value (load
with 0 to clear it).
5.
Load SMD52 (double word size value) with the desired preset value.
6.
In order to capture the current value equal to preset event, program an
interrupt by attaching the CV = PV interrupt event (event 13) to an interrupt
routine. See Section 9.15 for complete details on interrupt processing.
7.
In order to capture direction changes, program an interrupt by attaching the
direction changed interrupt event (event 14) to an interrupt routine.
8.
In order to capture an external reset event, program an interrupt by attaching
the external reset interrupt event (event 15) to an interrupt routine.
9.
Execute the global interrupt enable instruction (ENI) to enable interrupts.
10. Execute the HSC instruction to cause the S7-200 to program HSC1.
11. Exit the subroutine.
9-44
Enables the counter
Writes a new current value
Writes a new preset value
Sets the initial direction of the HSC to count up
Sets the start and reset inputs to be active high
Enables the counter
Writes a new current value
Writes a new preset value
Sets the initial direction of the HSC to count up
Sets the start and reset inputs to be active high
S7-200 Programmable Controller System Manual
A5E00066097-02

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents