The Count Down instruction that counts down by one every time the preceding logic transitions from false to true. The Counter.DN bit is set when the Accumulator reaches the Preset. The accumulator will continue to count even when the done bit is set. The CTD instruction can be paired with a CTU instruction referencing the same tag name. The overflow and underflow bits are set when the Accumulator exceeds the upper or lower limits.
List of arguments
COUNTER STRUCTURE PRE DEFINED STRUCTURE
- BOOL Counter.UP Count up bit, set when instruction is enabled.
- BOOL Counter.DN Count done bit, set when the accumulator reaches the preset.
- BOOL Counter.OV Count overflow bit, set when the count exceeds the upper limit of 2,147,483,647. The accumulator will roll over to -2,147,483,648 and begins counting down.
- BOOL Counter.UN Count overflow bit, set when the count exceeds the lower limit of -2,147,483,648. The accumulator will roll over to 2,147,483,647 and begins counting up.
- DINT Counter.PRE Count Preset value, when the accumulator reaches the preset the .DN bit is set.
- DINT Counter.ACC Count Accumulator value, keeps track of the current count.
Note: The CTD ladder instruction is reset with the RESET instruction referencing the CTD tag. The instruction could also be reset by moving a 0 into the Accumulator.