Program instructions
7.6 Counters
S7-200 SMART
264
System Manual, V2.3, 07/2017, A5E03822230-AF
7.6.5
High-speed counter programming
You can use the high-speed counter wizard to simplify HSC programming tasks. The wizard
helps you select the counter type/mode, preset/current values, counter options, and
generates the necessary special memory assignments, subroutines, and interrupt routines.
Note
You must ensure that high-speed counter inputs are correctly filtered and wired for counting
high frequency signals.
In an S7-200 SMART CPU, all high-speed counter inputs are connected to internal input
filter circuits. The S7-200 SMART CPU default input filter setting is 6.4 ms, which limits the
maximum counting rate to 78 Hz. You must change the filter settings to count higher
frequencies.
Refer to "Noise reduction for high-speed inputs (Page 261)" for details about system block
filter options, maximum counting frequency, shielding requirements, and external pull-down
circuits.
Configuring high-speed counters
Use one of the following actions to configure the high-speed counter wizard:
●
Open the wizard: Select "High-Speed Counter" in the wizards area of the Tools menu
ribbon strip.
●
Open the wizard: Double-click "High-Speed Counter" node in the wizards folder, from the
project tree.
With the wizard open, assign the HSC setup values. You can navigate through the wizard
setup pages, modify parameters, and then generate new wizard program code.
Your program must perform the following basic tasks to use a high-speed counter:
●
Define the counter and mode (execute the HDEF instruction exactly once for each
counter).
●
Set the control byte in SM memory.
●
Set the current value (starting value) in SM memory.
●
Set the preset value (target value) in SM memory.
●
Assign and enable appropriate interrupt routines.
●
Activate the high-speed counter (execute the HSC instruction).