4. Motion Control Instructions 4.6.18. CTD Explanation of the instruction: When EN is on and the loading input LD turns off -> on, the counter writes the preset value of PV into the current value of EV and the output CTD is reset. Each time the count-down input CD turns off -> on , the current value of EV is decreased by 1. When EV is decreased to 0, the output CTD turns on and the counter stops counting. CTD is used to achieve the function of downcounter. Explanation of input and output parameter of the instruction: DVP-MC operating manual 4-117 API Down counter Controller CTD 145 10MC11T Parameter Data Available Explanation name type device EN The execution condition of this instruction.
“CTU” instruction is executed as “EN” turns on; “CTD” and “EV” value keep unchanged as “EN” turns off. BOOL M,I,Q, constant CD When the count-down input “CD” turns off -> on, the current value of the counter is decreased by1. BOOL M,I,Q, constant LD When “LD” turns off -> on, the counter writes the preset value of “PV” into current value of “EV” and “CTD” is reset. BOOL M,I,Q, constant PV The preset value of the counter. UDINT Constant, D CTD When “EN” turns on and the current value of the counter is decreased to 0, the output bit “CTD” turns on. BOOL M,Q EV The current value of the counter.
When “EN” turns on and the count-down input “CD” turns off -> on, the current value of the counter is decreased by 1; as the current value of the counter decreased to 0, counting is stopped. UDINT D