AutomationView Documentation

CTU (Count-Up Counter)

Increments a counter on each rising edge of the count input and outputs TRUE when the current value .CV reaches the preset value .PV.


Description

The CTU (Count-Up) and CTUR instructions implement an IEC 61131-3 up-counter:


Syntax

Sequence Visual Editor

  1. Select an action on a step and open the Instruction picker (Alt or right-click -> Edit Qualifier & Instruction).
  2. Select Counters -> CTU (or CTUR) and choose the P (Pulse) qualifier.
  3. Enter the target count in PV (for example 100) and optionally assign a reset variable in the R input slot.

Action part_counter with the P qualifier, the CTU instruction badge and the PV 100 preset chip
The PV chip holds the preset; the R chip takes an optional reset variable.

Python

from automation_machine import ActionQualifier, ActionInstruction

step.add_action("counter_name", "Count up", qualifier=ActionQualifier.P, instruction=ActionInstruction.CTU, preset_value=100)

Parameters


Counter Variables

Variable Type Description
.CU BOOL Count-up input: rising edge increments .CV
.R BOOL Reset input: resets .CV to 0 and .Q to FALSE
.Q BOOL Output signal: TRUE when .CV >= .PV
.PV INT Preset target count
.CV INT Current accumulated count

See Also