High Speed Counting
Precision Pulse Processing
Capture every pulse with nanosecond accuracy. Master high-frequency signals, precise positioning via encoders, and real-time frequency measurement.
The Power of Technology Objects (TO)
Traditional PLC inputs are limited by the scan cycle time, making them unsuitable for high-frequency signals. TIA Portal High Speed Counters (HSC) use specialized hardware on the CPU or signal modules to count pulses independently of the OB1 cycle.
By using Technology Objects (TO), you gain access to an abstracted layer that handles encoder phases (A/B), Z-pulses, and measurement units automatically, allowing for sophisticated motion and flow tracking with minimal coding.
Counting & Positioning
Hardware counters and Encoder signals
TO_HighSpeedCounter Configuration
TO_HSCWhat it does
Configures the hardware interface for high-speed pulse acquisition. It handles counting directions, limits, and behavior at comparison values.
When to use it
Used for any application requiring precise part counting on conveyors, or simple position tracking where a full Motion axis is not needed.
Pro Tips
Check the CPU hardware limits; S7-1200 typically supports up to 6 HSCs, but frequency limits vary by input channel.
Use the 'Comparison value' events to trigger fast hardware outputs without waiting for the PLC program scan.
Enable the 'Sync' input if you need to reset or preset the counter value based on an external sensor (Z-pulse).
Encoder Support (A/B Phase)
QuadratureWhat it does
Decodes differential signals (Phase A, Phase B) to detect both speed and direction. Supports 1x, 2x, and 4x evaluation modes.
When to use it
Essential for incremental encoders used in rotary or linear displacement measurement where direction detection is critical.
Pro Tips
4x evaluation mode provides the highest resolution by counting every rising and falling edge of both A and B phases.
Ensure shielded cables are used for encoder signals to prevent electromagnetic interference from motor cables.
If your direction is inverted, you can swap the phases in the TO configuration without rewiring the hardware.
Advanced Measurement
Frequency, Period and Latch functions
Frequency & Period Measurement
Hz / msWhat it does
Calculates the instantaneous frequency (Hz) or time period (ms) between pulses. It includes built-in smoothing (filtering) for unstable signals.
When to use it
Ideal for flowmeters, anemometers, or measuring motor RPM via a simple proximity sensor and a gear wheel.
Pro Tips
Adjust the 'Update time' (Gate time) to balance between measurement speed and resolution for low frequencies.
The period measurement is often more accurate for very low frequency signals compared to frequency measurement.
Units can be scaled directly in the TO (e.g., pulses per liter) to get direct engineering values in your code.
Capture (Latch) Function
Value CaptureWhat it does
Saves the current counter value instantly when an external digital trigger (DI) is detected, bypassing software delays.
When to use it
Used for 'on-the-fly' measurements, such as recording the exact position of a product when a photo-eye is triggered.
Pro Tips
Configure the 'DI' input in the hardware settings of the HSC to enable the 'Capture' functionality.
Read the 'CapturedValue' parameter from the TO data block to retrieve the latched result.
Capture can be configured to trigger on the rising edge, falling edge, or both for double edge measurement.
Technology Object vs Legacy CTRL_HSC
Modern workflow vs legacy instruction set
| Feature | Technology Object (TO) | Legacy (CTRL_HSC) |
|---|---|---|
| Configuration | Graphical Interface | Hardware Constants / DBs |
| Data Access | Named TO Tags (DB) | System functions (SFB) |
| Diagnostics | Built-in Online Tools | Manual Error Codes |
| Measurement | Direct Hz/ms scaling | Requires manual math |
| Versatility | High (Integrated Motion) | Low (Stand-alone only) |
| Code Cleanliness | Superior (Symbolic) | Complex (Address-based) |
Frequently Asked Questions
What is the difference between a Technology Object HSC and the CTRL_HSC instruction?
The Technology Object (TO) provides a modern, graphical way to configure and monitor counters. It stores all data in a structured Data Block. CTRL_HSC is a legacy instruction that requires more manual setup and is mainly kept for compatibility or very simple tasks.
What is the maximum frequency I can count with an S7-1200?
On-board inputs typically support up to 100 kHz or 200 kHz depending on the model and the specific input (e.g., 6ES7214-1AG40-0XB0). High-speed Signal Boards can extend this to 1 MHz.
Which encoder types are supported by TIA Portal HSC?
It supports Single-phase (Pulse + Direction), Dual-phase (A/B quadrature), and Single-pulse counters. It works with 24V DC incremental encoders; 5V signals require a signal board or specific high-speed modules.
How do I diagnose a counter that isn't incrementing?
First, check the 'Status' bit in the TO. Use the Online & Diagnostics view to see if the hardware inputs are physically receiving pulses. Ensure the 'HW_ID' and 'Input address' in the TO configuration match your physical hardware.