Learn PLCs free
CountersIntermediateIEC 61131-3

CTU with Auto-Reset

Counter that automatically resets after reaching preset, creating repeating count cycles.

The CTU with Auto-Reset is a common programming pattern that combines the standard CTU (Counter Up) with automatic reset logic. When the counter reaches its preset value, it triggers an action and immediately resets itself to begin counting again. This pattern is used for repeating batch operations, periodic maintenance triggers, and cyclic event generation. While not a separate IEC 61131-3 standard block, it is one of the most frequently implemented counter patterns in production PLC code.

Parameters

Inputs

NameTypeDescription
CUBOOLCount up input
RBOOLManual reset input
PVINTPreset value (cycle count)

Outputs

NameTypeDescription
QBOOLPulse output - TRUE for one scan when CV = PV
CVINTCurrent counter value

Ladder Logic Example

// Ladder Logic - CTU with Auto-Reset
//
// |----[ Part_Sensor ]------[CTU Batch_Ctr]--------|
// |                         CU: Part_Sensor        |
// |                         R:  Auto_Reset         |
// |                         PV: 12                 |
// |                         Q:  Batch_Done         |
//
// |----[ Batch_Done ]-------( Auto_Reset )---------|  
// |----[ Batch_Done ]-------( Box_Eject )----------|

Structured Text Example

VAR
    Batch_Ctr : CTU;
    Part_Sensor : BOOL;
    Batch_Done : BOOL;
END_VAR

Batch_Ctr(CU := Part_Sensor, R := Batch_Done, PV := 12);
Batch_Done := Batch_Ctr.Q;
// Counter resets automatically each time 12 parts are counted

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)

Implement using CTU with Q output fed back to R input. Use one-shot for the done action.

AB

Allen-Bradley (Studio 5000)

Use CTU with .DN bit driving RES instruction. Common pattern in packaging applications.

C

CODESYS

Use standard CTU with Q connected back to R through action logic.

Common Applications

  • Repeating batch counting
  • Periodic lubrication triggers
  • Cyclic quality checks
  • Packing line box counts

Common Mistakes to Avoid

  • Auto-reset happening too fast and missing the done pulse
  • Race condition between done output and reset

Frequently Asked Questions

What is CTU with Auto-Reset in PLC programming?

Counter that automatically resets after reaching preset, creating repeating count cycles. The CTU with Auto-Reset is a common programming pattern that combines the standard CTU (Counter Up) with automatic reset logic. When the counter reaches its preset value, it triggers an action and immediately resets itself to begin counting again.

What are common applications of CTU with Auto-Reset?

CTU with Auto-Reset is commonly used for: Repeating batch counting, Periodic lubrication triggers, Cyclic quality checks, Packing line box counts.

How do I use CTU with Auto-Reset in different PLC platforms?

Siemens: Implement using CTU with Q output fed back to R input. Use one-shot for the done action. Allen-Bradley: Use CTU with .DN bit driving RES instruction. Common pattern in packaging applications. CODESYS: Use standard CTU with Q connected back to R through action logic.

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 →