RSLogix 5000 Counter Instruction – CTU, CTD, RES with Examples

Published on Aug 05, 2025 | Category: counter

Share this Page:

In RSLogix 5000, counter instructions are used to perform counting operations such as increasing, decreasing, or resetting a value based on input conditions. The three main counter instructions available are CTU (Count Up), CTD (Count Down), and CTUD (counter up down). Each instruction plays a crucial role in various automation tasks like item counting, batching, or event tracking.

This guide explains the structure, usage, parameters, and programming examples of each counter instruction in simple terms—perfect for beginners as well as experienced PLC programmers working with Allen Bradley controllers.

Types of Counters in RSLogix 5000

1. CTU (Count Up) Instruction

The CTU (Count Up) instruction is used to count events in an increasing manner. Every time the rung condition goes from false to true (rising edge), the accumulator value is incremented by 1. It is commonly used in applications like object counting, production tracking, and batch processing.

2. CTD (Count Down) Instruction

The CTD (Count Down) instruction is used to count down from a preset value. Each time the rung condition turns from false to true, the counter decreases by 1. It is useful for reverse counting applications such as countdown timers, material dispensing, or tracking remaining items.

3. CTUD (Count Up/Down) Instruction

The CTUD (Count Up/Down) instruction combines both CTU and CTD functions in one block. It allows separate inputs for count-up and count-down actions and is ideal for complex counting logic like position tracking, stock control, or cyclic operations where increments and decrements are both needed.

Counter Data Type in RSLogix 5000

In RSLogix 5000, counters such as CTU, CTD, and CTUD use the DINT (Double Integer) data type for the accumulator and preset values.

The DINT data type is a 32-bit signed integer, which allows the counter to store values in the range of:

This wide range enables accurate counting in large-scale automation systems without overflow or data loss.

img/rslogix-5000-counter/ctu-instruction-logic.webp

How to Declare a Counter Data Type in RSLogix 5000

To use a counter instruction like CTU, CTD, or CTUD, you must first declare a counter-type tag in RSLogix 5000. Follow these simple steps:

  1. Go to the Controller Tags or Program Tags tab.
  2. Click on “Edit Tags” and insert a new tag in the empty row.
  3. A dialog box will open. Fill in the following basic details:
  4. Press the Create or Enter key to add the tag.

Note: Other fields such as description, alias, and scope can be configured depending on your specific program requirements.

img/rslogix-5000-counter/counter-tag-declaration.webp

RSLogix 5000 Counter Up (CTU) Instruction in Ladder Logic

The Counter Up (CTU) instruction in RSLogix 5000 is used to perform incremental counting. Each time the input condition to the CTU instruction transitions from false to true (rising edge), the counter increases its accumulated value by 1.

When the accumulator value becomes equal to the preset value, the .DN (Done) bit is set to true, indicating that the counting target has been reached.

CTU Instruction Structure in RSLogix 5000:

  1. Counter: Insert or select a tag with the COUNTER data type. This tag holds the entire structure of the CTU instruction.
  2. PRE (Preset): A DINT value that defines the target count limit. The counter counts up until this value is reached.
  3. ACC (Accumulator): Stores the current count value. It increments by 1 on each rising input signal.
img/rslogix-5000-counter/ctu-instruction-ladder.webp

CTU Counter Tag Structure in RSLogix 5000

When using a CTU (Count Up) instruction in RSLogix 5000, a structured tag of type COUNTER is created. This tag includes several important fields that represent the current status and values of the counter. Below are the key components of the CTU counter structure:

.CU (Count Up Enable)

Data Type: BOOL
This bit holds the rung-condition-in status when the instruction was last executed. It indicates whether the input condition triggered the count.

.DN (Done Bit)

Data Type: BOOL
The done bit is set when the ACC (accumulated value) reaches or exceeds the PRE (preset value). It indicates that the counting operation is complete.

.OV (Overflow Bit)

Data Type: BOOL
The overflow bit is set when the accumulator exceeds the upper limit of a DINT, which is +2,147,483,647.

.UN (Underflow Bit)

Data Type: BOOL
This bit is set if the counter decrements below the lower limit of a DINT, which is −2,147,483,648. It is more relevant in down-counting scenarios.

.PRE (Preset Value)

Data Type: DINT
The preset is the target value that the accumulator needs to reach in order to set the done bit.

.ACC (Accumulator Value)

Data Type: DINT
This field stores the current count value. It increments by 1 on each valid rising edge of the input condition.

img/rslogix-5000-counter/ctu-tag-structure.webp

How the Counter Up (CTU) Instruction Works in RSLogix 5000

The CTU (Count Up) instruction is used to count upward whenever a rising edge (false to true transition) is detected on its enabling input condition. It is commonly used to count events like pulses, items on a conveyor, or signal changes.

1. Input Condition Detection

The CTU instruction monitors its rung condition. When the rung transitions from false to true (rising edge), the counter becomes active and increments its accumulator value by 1.

2. Accumulator Incrementation

Each valid rising edge increases the value of the .ACC (accumulator) by 1. The accumulator continues to grow with each input pulse.

3. Preset Value Comparison

The counter compares the accumulator .ACC with the preset value .PRE. When the accumulator is equal to or greater than the preset, the .DN (done) bit is set to true.

4. Resetting the Counter

To restart the counter, a RES (Reset) instruction is used. This resets the accumulator to 0 and clears the done bit.

RSLogix 5000 Counter Down (CTD) Instruction

The CTD (Count Down) instruction in RSLogix 5000 is used to perform decrementing count operations. Each time the input condition transitions from false to true (rising edge), the accumulator value decreases by 1. It is commonly used in scenarios where countdown logic is required, such as remaining items, steps, or cycles.

When the .ACC (accumulator) value becomes equal to or less than 0, the .DN (Done) bit is set to indicate that the counting has reached completion.

CTD Instruction Structure in RSLogix 5000:

  1. Counter: Select or insert a tag with the COUNTER data type to represent the CTD structure.
  2. PRE (Preset Value): The starting or maximum value from which the counter will count down. This is a DINT value.
  3. ACC (Accumulator): Holds the current count value and decreases by 1 on every valid input transition.

To reset the CTD instruction and restart counting, you must use a RES instruction linked to the same counter tag.

img/rslogix-5000-counter/ctd-instruction-ladder.webp

CTD Counter Tag Structure in RSLogix 5000

In RSLogix 5000, the CTD (Count Down) instruction uses a structured tag of the COUNTER data type. This tag includes several predefined fields that monitor and control the counter’s behavior. Below is an explanation of each field used in a CTD instruction:

.CD (Count Down Enable)

Data Type: BOOL
This bit reflects the rung-condition-in when the instruction was last executed. It shows whether the input condition was active (true) at the last scan.

.DN (Done Bit)

Data Type: BOOL
This bit is cleared (false) while the counter is still counting. It is set to true when the .ACC (accumulator) value reaches 0 or less, indicating that the countdown is complete.

.OV (Overflow Bit)

Data Type: BOOL
Set to true when the counter exceeds the upper limit of a DINT value, which is +2,147,483,647. This is more relevant when the accumulator is mistakenly incremented past its limit.

.UN (Underflow Bit)

Data Type: BOOL
This bit is set when the accumulator value goes below the DINT minimum limit, −2,147,483,648, usually in excessive decrement operations.

.PRE (Preset Value)

Data Type: DINT
This is the starting value of the countdown. The counter decrements from this value until the accumulator reaches 0 or less.

.ACC (Accumulator Value)

Data Type: DINT
This field holds the current value of the counter. It decreases by 1 on each valid input transition (rising edge).

img/rslogix-5000-counter/ctd-tag-structure.webp

How the Counter Down (CTD) Instruction Works in RSLogix 5000

The CTD (Count Down) instruction is used to perform decrementing operations. It reduces the value of the accumulator by 1 each time the input condition transitions from false to true (rising edge). This instruction is commonly used in countdown applications like tracking remaining cycles, parts, or steps.

1. Initial Setup

You must define a COUNTER tag with an initial .PRE (preset) value. This value determines the starting point for the countdown. The .ACC (accumulator) is initially set to this value.

2. Input Condition Detection

The CTD monitors the rung condition. Each time it detects a rising edge (false to true), it decrements the .ACC value by 1.

3. Countdown Process

Each valid input pulse decreases the accumulator. The current value is always stored in the .ACC field, and it continues to decrease with every rising edge.

4. Done Bit Activation

When the .ACC value becomes less than or equal to zero, the .DN (done) bit is set to true. This indicates that the countdown process has completed.

5. Resetting the Counter

To restart the countdown, use the RES instruction linked to the same counter tag. It resets the .ACC and .DN bits, allowing the counter to begin again from the preset value.