Try a PLC free — no signup
CountersAdvancedIEC 61131-3

HSC (High-Speed Counter)

Hardware-accelerated counter for high-frequency pulse inputs beyond normal scan rate.

The High-Speed Counter (HSC) function block is designed for counting high-frequency pulse inputs that exceed the normal PLC scan rate. Standard counters miss pulses when the input frequency is faster than the scan cycle. HSC uses dedicated hardware interrupts or high-speed input modules to count pulses at frequencies up to hundreds of kHz. HSC is essential for encoder feedback, flow meter pulse counting, high-speed packaging lines, and any application where accurate high-frequency pulse counting is required.

Parameters

Inputs

NameTypeDescription
EnableBOOLEnable the high-speed counter
ResetBOOLReset counter value
PVDINTPreset value
ModeINTCounter mode (single phase, quadrature, etc.)

Outputs

NameTypeDescription
QBOOLDone output when CV reaches PV
CVDINTCurrent counter value
DirectionBOOLCount direction (quadrature mode)

Ladder Logic Example

// High-Speed Counter - Encoder Position
// (Configuration is typically done in hardware setup)
//
// |----[ HSC_Enable ]-------[HSC Encoder_Count]----|
// |                         Channel: HSC0          |
// |                         Mode: Quadrature       |
// |                         PV: 10000              |
// |                         CV: Position           |

Structured Text Example

// HSC configuration is platform-specific
// Siemens example using CTRL_HSC
VAR
    HSC_Control : CTRL_HSC;
    Position : DINT;
    At_Target : BOOL;
END_VAR

HSC_Control(
    HSC := 0,           // HSC channel 0
    DIR := TRUE,        // Count direction
    CV := 0,            // New counter value (when NEW_CV)
    NEW_CV := FALSE     // Load new value flag
);
Position := HSC_Control.CV;
At_Target := (Position >= 10000);

Free to start

Run this block in your browser

Try the instruction on a live rung before you copy it into a project — nothing to install.

Run a PLC counter in your browser

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad

Platform-Specific Implementation

S

Siemens (TIA Portal)

Use CTRL_HSC system function in TIA Portal. Configure HSC channels in device configuration. S7-1200 supports up to 6 HSC channels.

AB

Allen-Bradley (Studio 5000)

Configure HSC module in I/O tree. Use HSC instruction or high-speed counter module (1756-HSC). Micro800 series has built-in HSC.

C

CODESYS

Platform-dependent; requires vendor-specific HSC library. Configure in device I/O settings.

Common Applications

  • Rotary encoder position feedback
  • Flow meter pulse counting
  • High-speed packaging line counting
  • Spindle speed measurement
  • Length measurement (wheel encoder)

Common Mistakes to Avoid

  • Not configuring dedicated high-speed inputs in hardware config
  • Using standard counter for high-frequency signals
  • Incorrect quadrature mode selection for encoders

Frequently Asked Questions

What is HSC (High-Speed Counter) in PLC programming?

Hardware-accelerated counter for high-frequency pulse inputs beyond normal scan rate. The High-Speed Counter (HSC) function block is designed for counting high-frequency pulse inputs that exceed the normal PLC scan rate. Standard counters miss pulses when the input frequency is faster than the scan cycle.

What are common applications of HSC (High-Speed Counter)?

HSC (High-Speed Counter) is commonly used for: Rotary encoder position feedback, Flow meter pulse counting, High-speed packaging line counting, Spindle speed measurement, Length measurement (wheel encoder).

How do I use HSC (High-Speed Counter) in different PLC platforms?

Siemens: Use CTRL_HSC system function in TIA Portal. Configure HSC channels in device configuration. S7-1200 supports up to 6 HSC channels. Allen-Bradley: Configure HSC module in I/O tree. Use HSC instruction or high-speed counter module (1756-HSC). Micro800 series has built-in HSC. CODESYS: Platform-dependent; requires vendor-specific HSC library. Configure in device I/O settings.

Free to start

Wire this block up and run it

Drop the instruction into a rung, press Run and watch it execute in your browser — then adapt it to your vendor tool.

Run a PLC counter in your browser

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad