Decrements .CV on each rising edge of .CD, sets .Q to TRUE when .CV <= 0, and reloads .CV with .PV when the dedicated LD (Load) operand is TRUE.
CTDR is a count-down counter with an explicit LD (Load) operand chip displayed directly on the action node in the Sequence Editor:
.CD — .CV decrements by 1..CV <= 0 — Output .Q becomes TRUE..LD (Load) is TRUE — .CV reloads to .PV and .Q becomes FALSE (assuming .PV > 0).PV (for example 10) and assign a boolean load variable in the LD operand chip.from automation_machine import ActionQualifier, ActionInstruction
step.add_action("magazine_slots", "Decrement remaining slots", qualifier=ActionQualifier.P, instruction=ActionInstruction.CTDR, preset_value=10, load="magazine_refilled")
ActionQualifier.P to decrement once per step activationActionInstruction.CTDRPV, for example 10)LD) — Boolean variable or expression that reloads .CV with .PV| Variable | Type | Description |
|---|---|---|
.CD |
BOOL |
Count-down input — rising edge decrements .CV |
.LD |
BOOL |
Load input — reloads .CV to .PV and sets .Q to FALSE |
.Q |
BOOL |
Output signal — TRUE when .CV <= 0 |
.PV |
INT |
Preset starting count |
.CV |
INT |
Current remaining count |