CTD
Decrementer
VAR_INPUT
VAR_INPUT
CD : BOOL; (* Count Down on rising edge *)
LOAD : BOOL; (* Load Start Value *)
PV : WORD; (* Start Value *)
END_VAR
VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (* Counter reached 0 *)
CV : WORD; (* Current Counter Value *)
END_VAR
When LOAD is TRUE, the counter variable CV will be initialized with the upper limit PV. If CD has a rising edge from FALSE to TRUE, CV will be lowered by 1 provided CV is greater than 0 (i.e., it doesn't cause the value to fall below 0).Q returns TRUE when CV is less than or equal to 0.
Requirements
Development environment |
Target system type |
PLC libraries to be linked |
---|---|---|
TwinCAT v3.0.0 |
PC or CX (x86) |
Tc2_Standard |