Program instructions
7.6 Counters
S7-200 SMART
System Manual, 09/2015, A5E03822230-AC
235
SM37.3 SM47.3 SM57.3 SM137.3 Counting direction control bit:
• 0 = Count down
• 1 =Count up
SM37.4 SM47.4 SM57.4 SM137.4 Write the counting direction to the HSC:
• 0 = No update
• 1 =Update direction
SM37.5 SM47.5 SM57.5 SM137.5 Write the new preset value to the HSC:
• 0 = No update
• 1 = Update preset
SM37.6 SM47.6 SM57.6 SM137.6 Write the new current value to the HSC:
• 0 = No update
• 1 =Update current value
SM37.7 SM47.7 SM57.7 SM137.7 Enable the HSC:
• 0 = Disable the HSC
• 1 =Enable the HSC
Read the HSC current value with your program
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 identifier number (0, 1, 2, or 3) as
shown in the following table. 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 double
word value; you cannot write a new current count to the high speed counter using the HC
data type.
Current values of HSC0, HSC1, HSC2, and HSC3
CV (counter current value)
Example: Reading and saving the current count value
MAIN
Save the value of HSC0 into
VD200 when I3.0 transitions
from OFF to ON.
LD I3.0
EU
MOVD HC0, VD200