Siemens SIMATIC S7-200 System Manual page 139

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

Advertisement

Table 6-28
Control Bits for HSC0, HSC1, HSC2, HSC3, HSC4, and HSC5
HSC0
HSC1
HSC2
SM37.3 SM47.3 SM57.3 SM137.3
SM37.4 SM47.4 SM57.4 SM137.4
SM37.5 SM47.5 SM57.5 SM137.5
SM37.6 SM47.6 SM57.6 SM137.6
SM37.7 SM47.7 SM57.7 SM137.7
Reading the Current Value
The current value of each high-speed counter can only be read using the data type HC
(High-Speed-Counter Current) followed by the counter number (0, 1, 2, 3, 4, or 5) as shown in
Table 6-29. Use the HC data type whenever you wish to read the current count, either in a status
chart or in the user program. The HC data type is read--only; you cannot write a new current count
to the high speed counter using the HC data type.
Table 6-29
Current Values of HSC0, HSC1, HSC2, HSC3, HSC4, and HSC5
Value to be Read
Current value (CV)
Example: Reading and Saving the Current Count
M
A
I
N
Setting Current Values and Preset Values
Each high-speed counter has a 32--bit current value (CV) and a 32--bit preset value (PV) stored
internally. The current value is the actual count value of the counter, while the preset value is a
comparison value optionally used to trigger an interrupt when the current value reaches the preset
value. You can read the current value using the HC data type as described in the previous
section. You cannot read the preset value directly. To load a new current or preset value into the
high-speed counter, you must set up the control byte and the special memory double-word(s) that
hold the desired new current and/or new preset values, and also execute the HSC instruction to
cause the new values to the transferred to the high-speed counter. Table 6-30 lists the special
memory double words used to hold the desired new current and preset values.
HSC3
HSC4
HSC5
SM147.3
SM157.3
SM147.4
SM157.4
SM147.5
SM157.5
SM147.6
SM157.6
SM147.7
SM157.7
HSC0
HSC1
HC0
HC1
Network 1
LD
EU
MOVD
S7-200 Instruction Set
Description
Counting direction control bit:
0 = Count down
Write the counting direction to the HSC:
0 = No update
Write the new preset value to the HSC:
0 = No update
Write the new current value to the HSC:
0 = No update
Enable the HSC:
0 = Disable the HSC
HSC2
HSC3
HSC4
HC2
HC3
HC4
//Save the value of
//High Speed Counter 0
//into VD200 when I3.0
//transitions from OFF to ON.
I3.0
HC0, VD200
Chapter 6
1 = Count up
1 = Update
direction
1 = Update preset
1 = Update current
value
1 = Enable the HSC
HSC5
HC5
125

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents