Overview: HSC Architecture on the SIMATIC S7-1500
The SIMATIC S7-1500 high-speed counter (HSC) subsystem uses a technology object (TO) model that differs substantially from the legacy S7-1200 and S7-300 counting blocks. On the S7-1500, every counting function is implemented as a Technology Object of type Counting or PositionInput, configured inside TIA Portal under PLC > Technology objects > Counting. The hardware front end (HF DI channel, onboard compact-CPU channel, or TM/ET 200 counting module) feeds the TO with edge events, gate-control signals, and synchronization data, while the TO itself owns the load value, comparator behavior, overflow handling, hysteresis, and the cyclic or interrupt-driven user interface.
This split between signal conditioning (the I/O module) and functionality (the TO) is why the Siemens catalog exposes three different digital-input sub-functions on the HF DI modules: DI (standard digital input), HSC (counting input), and Position Input (incremental encoder interface for SSI, TTL, or 24 V encoder tracks). Each HF channel can be assigned to exactly one of those modes per slot.
COUNT/CNTR_NO blocks. The TO interface (pluggable in TIA Portal V13 SP1 and later) replaces the old FB/DB approach and must be loaded into the CPU as part of the program compilation. Older STEP 7 V5.5 libraries are not portable.Terminology: DI vs. HSC vs. PosInp vs. Count
The Siemens S7-1500 manual collection distinguishes four input/function combinations that engineers frequently confuse when scaling a flow-meter application:
| Term | Hardware Carrier | Function | Typical Use |
|---|---|---|---|
| DI (Digital Input) | Any DI module, ST or HF | 1-bit boolean read in OB1 process image | Pushbuttons, status, slow sensors |
| HSC (High-Speed Counter) | HF DI channel configured as HSC | Edge counting with hardware gate, hardware comparator, latch | Pulse-type flow meters, part counters, piece counters |
| Position Input (PosInp) | HF DI channel configured as PosInp | A/B/N incremental encoder evaluation, 1x/2x/4x multiplier | Length measurement, SSI position, motion feedback |
| Count (Counting TO) | HSC or PosInp channel + TO Counting | Adds load value, hysteresis, comparators, captured values, interrupt generation | Flow totalization with K-factor, batch counting, dosing |
For a flow-meter pulse train, the correct combination is: HSC hardware channel feeding a Counting TO. The TO is where you enter the K-factor (pulses per litre), configure the comparator events, and select whether an interrupt should fire on each captured value.
S7-1500 HF DI Module Specifications
Two HF DI modules are commonly considered for HSC applications. Both expose HSC capability on the first two input channels of each subgroup:
| Parameter | 6ES7521-1BH00-0AB0 | 6ES7521-1BL00-0AB0 |
|---|---|---|
| Description | SM 521 DI 16x24VDC HF | SM 521 DI 32x24VDC HF |
| Number of inputs | 16 | 32 |
| HSC-capable channels | First 2 of each group (Ch0, Ch1; groups A and B) | First 2 of each subgroup (4 subgroups → 8 HSC-capable channels) |
| Max HSC frequency (firmware ≥ V2.0) | 1 kHz per channel (24 V, push-pull) | 1 kHz per channel (24 V, push-pull) |
| Encoder interface | 24 V A/B/N, PNP/NPN | 24 V A/B/N, PNP/NPN |
| Hardware gate | Yes, per channel | Yes, per channel |
| Hardware comparator / latch | Yes, per channel | Yes, per channel |
| Min. pulse width | 500 µs | 500 µs |
| Isolation | Yes, channel-to-channel via groups | Yes, channel-to-channel via subgroups |
6ES7551-1AB00-0AB0) are required for higher frequencies.For higher pulse rates, use the technology modules TM Count 2x24V (6ES7550-1AA00-0AB0, up to 200 kHz) or the ET 200SP TM Count 1x24V (up to 100 kHz). These are wired in PositionInput or Counting mode and use the same TO type as the HF DI HSC channels.
Compact CPU Onboard HSC (CPU 151xC, CPU 1512C-1 PN)
Compact S7-1500 CPUs integrate the HF digital inputs and HF digital outputs on the front connector itself, eliminating the need for additional SM 521 modules. The CPU 1512C-1 PN (article number 6ES7512-1CM03-0AB0) provides:
- 32 onboard digital inputs (24 V DC), of which 32 are HSC-capable in single-channel mode.
- Maximum input frequency per HSC channel: 100 kHz (push-pull source) or 1 MHz with TM Count modules.
- Isolated input groups for noise immunity in industrial environments.
- 16 onboard digital outputs, of which up to 16 are PWM-capable (high-speed output).
For an application with up to 8–10 flow meters, the compact CPU is the most cost-effective platform: the HSC channels are included in the base price, no SM 521 modules are required, and TIA Portal hardware configuration already exposes the HSC channels for assignment. Select the compact CPU variant only if the application genuinely needs onboard HSC and onboard analog I/O; otherwise the modular CPU 1515-2 PN + SM 521 combination is more scalable.
Configuring the Counting Technology Object in TIA Portal
Configuration is split between the hardware side (which channel acts as HSC) and the software side (the Counting TO). Both must agree; otherwise the TO shows STATUS_HW_ERROR at runtime.
- Hardware configuration: Open the device view of the S7-1500 station, select the HF DI module or the compact CPU, and switch to the Properties > Inputs tab. Set the input mode of the desired channel pair from DI to Counting or Position Input for Motion Control.
- Assign signal type: Choose 24 V encoder, PNP for a typical flow-meter open-collector / push-pull output. Set the counting direction (up/down) and the gate control source (software gate, hardware gate, or both).
- Create the TO: In the project tree, right-click PLC > Technology objects > Counting > Add new. Select Counting (not Position Input). The TO wizard prompts for the assigned HSC channel.
-
Configure the TO: In the TO configuration editor, set the load value (typically 0), the upper and lower counting limits (0–2147483647 for unsigned 32-bit), the comparator events (e.g.
Comp1 = LoadValue + 1000), and the capture/reset behavior. - Map the unit conversion: In Counting > Units, set 1 pulse = x litres using the flow-meter K-factor. This makes the captured value directly readable in engineering units.
-
Generate the program blocks: TIA Portal auto-generates the
Countinginstance DB, theMC_ResetCount,MC_Gate, andMC_HomeCountFBs. Drag them into your cyclic OB. - Compile and download: The TO is compiled into the S7-1500 firmware as part of the program. Use Online > Download to device to transfer both the program and the technology configuration.
Pulse-Input Scaling for Flow Meters
The standard Siemens application pattern for flow-meter HSC channels is:
Q (l/min) = (fpulse × 60) / K
where:
-
fpulse= measured pulse frequency in Hz (pulses per second) -
K= K-factor in pulses per litre, taken from the flow-meter data sheet -
60= conversion from seconds to minutes
For totalization, integrate Q over time or, more efficiently, read the captured count every scan and apply:
Vtotal = Ntotal / K
The TO Counting already maintains Ntotal as a 32-bit unsigned counter. Multiply by the unit conversion factor set in the TO properties to obtain the volume in litres directly. If the flow meter supports a 1000 pulses/litre K-factor and the maximum flow is 60 l/min, the maximum pulse frequency is:
fmax = (Qmax × K) / 60 = (60 × 1000) / 60 = 1000 Hz
This is exactly the rated 1 kHz limit of the SM 521 HF DI HSC channel, confirming that the 6ES7521-1BH00-0AB0 or 6ES7521-1BL00-0AB0 is dimensioned correctly for typical low-frequency pulse flow meters. For > 1 kHz pulse rates, use a TM Count 2x24V (200 kHz) module or step up to a frequency-converting flow meter.
Module Selection Strategy for 8–9 Pulse Inputs
Engineers frequently need to scale a stock S7-1500 system for 8 or 9 pulse inputs from flow meters. The available options are:
| Option | Hardware | HSC Channels | Cost Class | Notes |
|---|---|---|---|---|
| Compact CPU only | CPU 1512C-1 PN (6ES7512-1CM03-0AB0) | 32 | $$ | Best fit for 8–16 channels at 1 kHz; HSC + PWM integrated |
| Modular CPU + 1× SM 521 (16) | CPU 1515-2 PN + 6ES7521-1BH00-0AB0 | 4 (2 per group) | $$$ | Not enough – provides only 4 HSC channels |
| Modular CPU + 1× SM 521 (32) | CPU 1515-2 PN + 6ES7521-1BL00-0AB0 | 8 (2 per subgroup) | $$$ | Exact fit for 8 channels |
| Modular CPU + 5× SM 521 (16) | CPU 1515-2 PN + 5× 6ES7521-1BH00-0AB0 | 20 | $$$$$ | Overspecified; not cost effective |
| TM Count + ET 200MP | CPU 1515-2 PN + IM 155-5 PN + 2× TM Count 2x24V | 4–16 | $$$$ | Required only when pulse frequency > 1 kHz |
| Distributed via ET 200SP | CPU 1515-2 PN + ET 200SP + TM Count modules | up to 64 per station | $$$ | Use when flow meters are spatially distributed |
For the typical flow-meter application in the field report (8–9 pulse inputs at low kHz rate), the most economical configuration is the CPU 1512C-1 PN compact CPU. It delivers 32 HSC-capable onboard inputs at 100 kHz each, and the base list price is comparable to a modular CPU plus a single SM 521 module. If the design must remain modular (i.e. future expansion or spare slots), one 6ES7521-1BL00-0AB0 (32 HF DI) provides 8 HSC channels; pair this with an IM 155-5 PN ET 200MP station for any overflow channels.
Alternatives to HSC: Time-Triggered Interrupts on DI Channels
If the pulse frequency is well below the HSC limit (e.g. < 200 Hz for typical process flow meters), the TO Counting machinery can be bypassed in favor of a simpler time-triggered interrupt. The trade-off is loss of hardware synchronization and reduced accuracy at high flow rates.
- Configure the DI channels of a standard SM 521 or SM 531 as ordinary inputs.
- Create an OB with OB period = 1 ms (i.e. cyclic interrupt, time-of-day OB 30 series).
- Inside the OB, read the
:P(direct peripheral access) of each DI channel and increment a counter on every rising edge. Use the:Psuffix to bypass the process image update. - Apply the K-factor in the cyclic OB at the scan rate matching the slowest expected flow change.
This approach consumes zero HSC resources, allows arbitrary channel counts on cheap ST DI modules, and integrates with the standard process image. The drawback is that pulse counts are lost if the OB execution time exceeds the OB period — at 1 ms and a CPU 1515-2 PN running ~30 % user program load, the OB typically completes in under 200 µs, leaving ample headroom for nine pulse inputs.
Wiring and Encoder Integration
Standard wiring for a 24 V pulse flow meter to an S7-1500 HF DI HSC channel:
- Brown wire (+24 V DC supply) → CPU/SM 24 V sensor power output, fused at 0.5 A.
- Blue wire (0 V / GND) → CPU/SM 24 V ground.
- Black wire (pulse output, push-pull, 24 V) → HF DI input terminal, configured as HSC, type 24 V encoder PNP.
- Yellow/green shield → functional earth terminal on the S7-1500 shield bar, terminated within 100 mm of the module.
For incremental encoders that require a Z (zero) reference, route channel Z to a separate HF DI and configure it as the Reference input on the Position Input TO. The same wiring topology applies whether the encoder is an IFM, SICK, Turck, or Balluff 24 V push-pull model. The IFM encoder integration example for the S7-1500 documents the same procedure with an IFM RN-series encoder, which is useful as a generic reference.
Commissioning and Verification
After loading the hardware configuration and the program, perform these checks before connecting field wiring:
-
Online → Monitoring: Open the TO Counting instance DB and confirm
StatusWord.Gate= TRUE once the gate is opened by user logic or HMI. - Force the HSC input: In TIA Portal use the Online & diagnostics > Force table to toggle the configured channel at 100 Hz, then read the captured count from the TO. The count must increment by exactly 100 per second.
-
Verify the comparator: Set a low comparator value (e.g. 10 pulses) and confirm that the user-program interrupt OB fires when
StatusWord.Comparator1goes TRUE. - Confirm the K-factor: Run a calibration: feed 1000 pulses at a known reference frequency and compare the TO captured value against the expected engineering unit value. Drift of more than 1 pulse per 10 000 indicates missed edges — either the OB period is too long, or the input filter is set incorrectly.
-
Check the diagnostic buffer: The CPU diagnostic buffer records any
TO <name> HW faultevents, which usually indicate a channel-mode mismatch between the hardware configuration and the TO configuration.
Troubleshooting Matrix
| Symptom | Likely Cause | Remediation |
|---|---|---|
| TO shows STATUS_HW_ERROR immediately after start | Channel mode in device configuration is still DI, not Counting | Re-open device view, switch the channel to Counting, recompile and download |
| Count does not increment, but input LED flashes | Hardware gate not opened or software gate disabled in TO configuration | Open the gate via MC_Gate FB or set Gate control = "software" in TO properties |
| Count is half the expected value | Quadrature decoder active on a single-channel pulse source | Set encoder mode to Single instead of 1x / 2x / 4x |
| Pulses lost at high frequency | Input filter on DI channel set to 3 ms or 10 ms | Reduce input filter to 0.1 ms or disable |
| HSC channel reports "channel not available" after firmware update | Module firmware < V2.1 paired with new HSP features | Match HSP version with module firmware, reload GSD |
| Count overflows repeatedly | Upper counting limit set lower than the maximum expected pulse total | Raise upper counting limit to 2 147 483 647 or apply periodic MC_ResetCount
|
| Comparator event fires late | User-program OB has a long cycle time | Move comparator event handling into a hardware interrupt OB (OB40) |
Frequently Asked Questions
What is the difference between HSC, PosInp, and Count on the S7-1500?
HSC is the hardware channel mode on the HF DI module that captures edges; PosInp is the channel mode for incremental encoder (A/B/N) decoding; Count is the Technology Object of type Counting that takes the HSC or PosInp edges and adds load value, comparator, and K-factor scaling. For a flow-meter pulse train you need both: the HSC channel + a Counting TO.
How many HSC channels does a SM 521 DI 16x24VDC HF (6ES7521-1BH00-0AB0) provide?
The 16-channel HF module provides 4 HSC-capable inputs (2 per group of 8). Each HSC channel supports up to 1 kHz in single-channel mode or 4x quadrature up to 250 kHz per channel pair. For higher pulse rates, use a TM Count 2x24V module instead.
Can I count 9 flow-meter pulses without buying 5 SM 521 modules?
Yes. The most cost-effective solution is a CPU 1512C-1 PN (6ES7512-1CM03-0AB0) compact CPU, which integrates 32 HSC-capable inputs at 100 kHz each. Alternatively, one 6ES7521-1BL00-0AB0 (32 HF DI) supplies 8 HSC channels, and one IM 155-5 PN ET 200MP station with a TM Count module covers the 9th channel.
Do I need technology objects if the application is flow metering rather than motion control?
Yes, but only the Counting TO, not the motion-control TOs (TO_SpeedAxis, TO_PositioningAxis, TO_SynchronousAxis). The Counting TO gives you the K-factor scaling, comparator events, and the load-value reset logic that flow totalization needs.
Can I use a standard DI module (non-HF) to count pulses?
Only if the pulse frequency is < 200 Hz and the PLC scan time is below 1 ms. Wire the DI channel to a cyclic interrupt OB (OB30 family), read it with the :P suffix, and increment a counter on each rising edge. The standard SM 521 DI 32x24VDC ST has no HSC hardware comparator or hardware gate, so accuracy is reduced at high flow rates.