Siemens SIMATIC S7-200 System Manual page 140

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

Advertisement

S7-200 Programmable Controller System Manual
Use the following steps to write a new current value and/or new preset value to the high-speed
counter (steps 1 and 2 can be done in either order):
1.
Load the value to be written into the appropriate SM new--current value and/or new preset
value (Table 6-30). Loading these new values does not affect the high-speed counter yet.
2.
Set or clear the appropriate bits in the appropriate control byte (Table 6-28) to indicate
whether to update the current and/or preset values (bit x.5 for preset and x.6 for current).
Manipulating these bits does not affect the high-speed counter yet.
3.
Execute the HSC instruction referencing the appropriate high-speed counter number.
Executing this instruction causes the control byte to be examined. If the control byte
specifies an update for the current, the preset, or both, then the appropriate values are
copied from the SM new current value and/or new preset value locations into the
high--speed counter internal registers.
Table 6-30
New Current and New Preset Values of HSC0, HSC1, HSC2, HSC3, HSC4, and
HSC5
Value to be Loaded
New current value (new CV)
New preset value (new PV)
Tip
Changes to the control byte and the SM locations for new current value and new preset value
will not affect the high-speed counter until the corresponding HSC instruction is executed.
Example: Updating the Current and Preset Values
M
A
I
N
Assigning Interrupts
All counter modes support an interrupt event when the current value of the HSC is equal to the
loaded preset value. Counter modes that use an external reset input support an interrupt on
activation of the external reset. All counter modes except modes 0, 1, and 2 support an interrupt
on a change in counting direction. Each of these interrupt conditions can be enabled or disabled
separately. For a complete discussion on the use of interrupts, see the section on
Communications and Interrupt instructions.
Notice
A fatal error can occur if you attempt either to load a new current value or to disable and then
re-enable the high-speed counter from within the external reset interrupt routine.
Status Byte
A status byte for each high-speed counter provides status memory bits that indicate the current
counting direction and whether the current value is greater or equal to the preset value. Table 6-31
defines these status bits for each high-speed counter.
126
HSC0
HSC1
HSC2
SMD38
SMD48
SMD58
SMD42
SMD52
SMD62
Network 1
LD
EU
MOVD
MOVD
=
=
HSC
HSC3
HSC4
SMD138
SMD148
SMD142
SMD152
//Update the current count to 1000
//and the preset value to 2000
//for High-Speed counter 0 when I2.0
//transitions from OFF to ON
I2.0
1000, SMD38
2000, SMD42
SM37.5
SM37.6
0
HSC5
SMD158
SMD162

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents