Siemens SIMATIC S7-200 System Manual page 141

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

Advertisement

Tip
Status bits are valid only while the high-speed counter interrupt routine is being executed. The
purpose of monitoring the state of the high-speed counter is to enable interrupts for the events
that are of consequence to the operation being performed.
Table 6-31
Status Bits for HSC0, HSC1, HSC2, HSC3, HSC4, and HSC5
HSC0
HSC1
HSC2
SM36.0
SM46.0
SM56.0
SM36.1
SM46.1
SM56.1
SM36.2
SM46.2
SM56.2
SM36.3
SM46.3
SM56.3
SM36.4
SM46.4
SM56.4
SM36.5
SM46.5
SM56.5
SM36.6
SM46.6
SM56.6
SM36.7
SM46.7
SM56.7
Sample Initialization Sequences for the High-Speed Counters
HSC1 is used as the model counter in the following descriptions of the initialization and operation
sequences. The initialization descriptions assume that the S7-200 has just been placed in RUN
mode, and for that reason, the first scan memory bit is true. If this is not the case, remember that
the HDEF instruction can be executed only one time for each high-speed counter after entering
RUN mode. Executing HDEF for a high-speed counter a second time generates a run-time error
and does not change the counter setup from the way it was set up on the first execution of HDEF
for that counter.
Tip
Although the following sequences show how to change direction, current value, and preset
value individually, you can change all or any combination of them in the same sequence by
setting the value of SMB47 appropriately and then executing the HSC instruction.
Initialization Modes 0, 1, or 2
The following steps describe how to initialize HSC1 for Single Phase Up/Down Counter with
Internal Direction (Modes 0, 1, or 2).
1.
Use the first scan memory bit to call a subroutine in which the initialization operation is
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
HSC3
HSC4
HSC5
SM136.0
SM146.0
SM156.0
SM136.1
SM146.1
SM156.1
SM136.2
SM146.2
SM156.2
SM136.3
SM146.3
SM156.3
SM136.4
SM146.4
SM156.4
SM136.5
SM146.5
SM156.5
SM136.6
SM146.6
SM156.6
SM136.7
SM146.7
SM156.7
Produces the following results:
Enables the counter
Writes a new current value
Writes a new preset value
Sets the direction to count up
Sets the start and reset inputs to be active high
S7-200 Instruction Set
Description
Not used
Not used
Not used
Not used
Not used
Current counting direction status bit:
0 = Counting down
1 = Counting up
Current value equals preset value status bit:
0 = Not equal
1 = Equal
Current value greater than preset value
status bit:
0 = Less than or equal
1 = Greater than
Chapter 6
127

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents