AutomationView Documentation

CTD (Count-Down Counter)

Decrements a counter on each rising edge of the count input and outputs TRUE when the current value .CV reaches 0.


Description

The CTD (Count-Down) and CTDR instructions implement an IEC 61131-3 down-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 -> CTD (or CTDR) and choose the P (Pulse) qualifier.
  3. Enter the starting count in PV (for example 50) and optionally assign a load variable in the LD input slot.

Action parts_left with the P qualifier, the CTD instruction badge and the PV 24 preset chip
The PV chip holds the start value of the down counter.

Python

from automation_machine import ActionQualifier, ActionInstruction

step.add_action("counter_name", "Count down", qualifier=ActionQualifier.P, instruction=ActionInstruction.CTD, preset_value=50)

Parameters


Counter Variables

Variable Type Description
.CD BOOL Count-down input: rising edge decrements .CV
.LD BOOL Load input: sets .CV to .PV and .Q to FALSE
.Q BOOL Output signal: TRUE when .CV <= 0
.PV INT Preset starting count
.CV INT Current remaining count

See Also