Learn PLCs free
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);

20 Production-Ready Ladder Logic Templates

Stop writing the same rungs from scratch. Get copy-paste-ready templates for motor control, PID loops, safety interlocks, conveyors, and more.

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.

Stop Writing Ladder Logic From Scratch

Get 20 production-ready ladder logic templates for $29 -- download instantly and use them on your next project today.

20
Ready-Made Templates
LD + ST
Both Languages Included
$29
One-Time Purchase
Get Instant Access -- $29

Instant download - 30-day money-back guarantee - Use on unlimited projects

Free PLC simulator

Wire this block up and run it

Drop the instruction into a rung, hit Run, and watch it execute in your browser. 12 guided lessons across 8 PLC dialects — free account, no credit card.

Practice PLCs free →