Initialization Modes 6, 7, Or 8 - Siemens SIMATIC S7-200 System Manual

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

Advertisement

Initialization Modes 6, 7, or 8

The following steps describe how to initialize HSC1 for Two Phase Up/Down
Counter with Up/Down Clocks (Modes 6, 7, or 8):
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:
SMB47 = 16#F8 produces the following results:
3.
Execute the HDEF instruction with the HSC input set to 1 and the MODE set
to 6 for no external reset or start, 7 for external reset and no start, or 8 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.
S7-200 Programmable Controller System Manual
A5E00066097-02
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
SIMATIC Instructions
9-43

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents