Specifications

SIMATIC Instructions
9-38
S7-200 Programmable Controller System Manual
C79000-G7076-C233-01
Control Byte
Once you have defined the counter and the counter mode, you can program the
dynamic parameters of the counter. Each high-speed counter has a control byte
that allows the counter to be enabled or disabled; the direction to be controlled
(modes 0, 1, and 2 only), or the initial counting direction for all other modes; the
current value to be loaded; and the preset value to be loaded. Examination of the
control byte and associated current and preset values is invoked by the execution
of the HSC instruction. Table 9-12 describes each of these control bits.
Table 9-12 Control Bits for HSC0, HSC1, and HSC2
HSC0
HSC1 HSC2 HSC3 HSC4 HSC5 Description
SM37.0 SM47.0 SM57.0 SM137.0 SM147.0 SM157.0 Not used after HDEF has been executed
(Never used by counters that do not
have an external reset input)
SM37.1 SM47.1 SM57.1 SM137.1 SM147.1 SM157.1 Not used after HDEF has been executed
(Never used by counters that do not
have a start input)
SM37.2 SM47.2 SM57.2 SM137.2 SM147.2 SM157.2 Not used after HDEF has been executed
(Never used by counters that do not
support quadrature counting)
SM37.3 SM47.3 SM57.3 SM137.3 SM147.3 SM157.3 Counting direction control bit:
0 = count down; 1 = count up
SM37.4 SM47.4 SM57.4 SM137.4 SM147.4 SM157.4 Write the counting direction to the HSC:
0 = no update; 1 = update direction
SM37.5 SM47.5 SM57.5 SM137.5 SM147.5 SM157.5 Write the new preset value to the HSC:
0 = no update; 1 = update preset
SM37.6 SM47.6 SM57.6 SM137.6 SM147.6 SM157.6 Write the new current value to the HSC:
0 = no update; 1 = update current value
SM37.7 SM47.7 SM57.7 SM137.7 SM147.7 SM157.7 Enable the HSC: 0 = disable the HSC; 1
= enable the HSC
Setting Current Values and Preset Values
Each high-speed counter has a 32-bit current value and a 32-bit preset value. Both
the current and the preset values are signed integer values. To load a new current
or preset value into the high-speed counter, you must set up the control byte and
the special memory bytes that hold the current and/or preset values. You must
then execute the HSC instruction to cause the new values to be transferred to the
high-speed counter. Table 9-13 describes the special memory bytes used to hold
the new current and preset values.
In addition to the control bytes and the new preset and current holding bytes, the
current value of each high-speed counter can be read using the data type HC
(High-Speed Counter Current) followed by the number (0, 1, 2, 3, 4, or 5) of the
counter. Thus, the current value is directly accessible for read operations, but can
only be written with the HSC instruction described above.