MOULDLKnowledge BaseElectrical Knowledge Base3D Model DownloadsMembership
中文版Model Store »
Knowledge Base › Electrical Knowledge Base › What can the S7-1500 high-speed counter do, and how is it used?
HomeModels
Table of contents

On this page

PLC & Programming (100 articles)

Quick Reference

  • PLC & Programming
  • Electrical & Electronic Basics (monthly)(每月更新中)
  • Electrical Control & Drawings (monthly)(每月更新中)
  • Drives & Actuators (monthly)(每月更新中)
  • Sensors & Detection (monthly)(每月更新中)
  • Industrial Communication & Networks (monthly)(每月更新中)
  • HMI & Host Systems (monthly)(每月更新中)
  • Industrial Robots & Motion Control (monthly)(每月更新中)
  • Mechatronic System Integration (monthly)(每月更新中)
  • Fault Diagnosis & Standards (monthly)(每月更新中)

What can the S7-1500 high-speed counter do, and how is it used?

Every S7-1500 CPU has high-speed counters (HSC) built in: hardware counter units that tally encoder or pulse signals directly, without loading the scan cycle, so they keep up with pulses far faster than the program loop. Using them comes down to three decisions: the counting mode, the signal input type, and the gating and reset conditions.

Why an ordinary counter will not do

An add counter in OB1 runs once per scan, so the count drifts as soon as the cycle time changes, and short pulses that rise and fall between two scans are lost entirely. An HSC counts in hardware, and the program only reads the current value and the status bits, so it can follow signals in the kHz range and above. The first selection question is therefore whether the pulse frequency exceeds what the scan can capture; if it does, an HSC or a dedicated counter module is required.

The common counting modes

Configuration normally offers counting, frequency measurement, period measurement and position tracking. Counting mode adds or subtracts pulses and reports a current value; frequency measurement works out the pulse rate over a fixed time window and is used for speed; period measurement suits very slow signals and derives speed from the interval between pulses; position tracking follows an incremental encoder to record displacement. The mode also decides how direction is determined. Single-phase uses one pulse input and takes direction from the program; two-phase uses the A/B quadrature pair and derives direction from the phase order automatically; up/down counting uses two separate inputs, one for forward pulses and one for reverse pulses.

Input signals and gating

Each HSC channel needs an assigned pulse input, a direction input, and digital inputs that act as gate or reset. The gate decides when counting is active; the reset clears the count to zero. These inputs are fixed high-speed channels on the CPU or technology module and cannot be re-assigned as ordinary I/O. Sourcing or sinking wiring must match the polarity of the module common terminal, otherwise the signal level cannot be resolved.

Configuration and programming points

Enable the HSC in the hardware configuration, pick the operating mode, then set the counting range, the comparison values and the output response. Most applications read the count into the process image or via an instruction and set an output with a comparison instruction when the setpoint is reached; where an immediate reaction is needed, the hardware comparator does it with no scan delay. An interrupt can be triggered on reaching a comparison value or on zero crossing to catch a momentary event, but keep the interrupt routine short.

Typical applications

Common uses include spindle speed, web or coil length measurement, flow-pulse totalising and work-piece positioning. Speed conversion needs care with units: frequency divided by pulses per revolution gives revolutions per second, and only after multiplying by 60 do you get r/min. For length, divide the accumulated count by the pulses per metre. Flow totalising converts each pulse into the volume it represents. The higher the frequency, the more the signal quality and cable screening matter.

Counting modes and signal types at a glance

Counting modeSignal inputsDirectionTypical use
Single-phase countingOne pulse inputUp or down, set by the programSimple pulse totalising
Up/down countingOne forward, one reverse inputFrom which input the pulse arrives onBi-directional length
Two-phase counting (1x)A/B quadratureFrom the phase order of the pairSlow positioning
Two-phase counting (2x)A/B quadratureRising and falling edges countedHigher resolution
Two-phase counting (4x)A/B quadratureAll edges of both phases countedHigh-precision tracking
Frequency measurementOne pulse inputNot applicableMid to high speed measurement
Period measurementOne pulse inputNot applicableLow speed measurement
Gated countingPulse + gateSet by the programCounting within a window
Reset countingPulse + resetSet by the programRepeating piece counting

Notes

How many HSC channels, what maximum frequency and which modes a CPU or technology module supports differ from one model to another; the manufacturer's manual is the authority. The higher the frequency and the longer the cable, the more signal quality matters, and for long runs or electrically noisy areas a differential encoder on twisted screened cable is preferred. The counter only counts; direction and position logic still have to be handled in the program.

References

The high-speed counter function blocks and programming language conventions follow GB/T 15969.3 (identical to IEC 61131-3) and the equipment requirements standard IEC 61131-2. The electrical connection, protection and earthing of the counter wiring follow GB 5226.1 and the equivalent international standard IEC 60204-1. The frequency and mode figures quoted here are general; the exact limits are as stated in the manufacturer's manual.

Points to watch

⚠️ Three common traps:
(1) Using an ordinary input point as a high-speed counter input, so counts are dropped as soon as the pulse rate rises and the program gets blamed instead;
(2) Choosing single-phase when two-phase is needed, so the count still rises when the motor reverses and the position drifts further off;
(3) Wiring that ignores the encoder output type (PNP/NPN, single-ended/differential), leaving too little signal amplitude and producing a jittering count.

Stop the machine before changing the HSC configuration, and make wiring changes only after isolating, proving dead and applying lock-out/tag-out. Routing signal cables away from power cables markedly reduces false counts caused by common-mode noise.

Related reading

Related 3D models: Ready to build it? Download free 3D models & CAD drawings at MOULDL »
MOULDL · Electrical Knowledge Base · free self-study reference for electrical & automation engineers, 3D CAD models at MOULDL