CTD (Functionblock) |
Top Previous Next |
CTD is a Down counter. This function block will count the "cv" value one down on each rising edge on the "cd" input. When the "cv" variable reaches 0, the output "q" will go high - otherwise it will be low. If a high signal is present on the "ld" input, the value from "pv' will be copied to "cv".
Input: cd : BOOL (true/false) On the leading edge of this input the "cv" will be decremented with 1. When the "cv" value is equal to 0, "q" will be high
ld : BOOL (true/false) Load input. When this input is high, the "cv" will set to the value in "pv".
pv : INT (0..32767) Preset value for the counter.
Output: cv : INT (0..32767) Default -1 The current value of the counter.
q : BOOL (true/false) Output from the counter. See description for "cd".
Declaration: FUNCTION_BLOCK CTD;
Example: INCLUDE rtcu.inc |