The CTU Function block counts rising edges until a preset limit is reached.
| Parameter | Type | Direction | Description |
|---|---|---|---|
| CU | BOOL R_EDGE | Input | A rising edge increments the counter value CV by 1. |
| R | BOOL | Input | Resets the output Q and the counter value CV. |
| PV | INT | Input | The counter limit value. |
| Q | BOOL | Output | Set to true when the counter value CV reaches PV. |
| CV | INT | Input | The current counter value. |
The Up Counter is logically equivalent to:
Function_Block CTU
Var_Input CU : BOOL R_EDGE; R : BOOL; PV : INT; End_Var
Var_Output Q : BOOL; CV : INT; End_Var
IF R THEN
CV := 0;
ELSEIF CU AND (CV < PV )
CV := CV + 1;
END_IF;
Q := (CV >= PV);
End_Function_Block
IEC 61131-3 Second Edition: Table 36.1a.
IEC 61131-3 Third Edition: Table 44.1a.
To learn about other standard function blocks.
To learn about the different types supported by Fernhill SCADA.
To learn about other IEC 61131-3 Common Elements.
For the meaning of terms used in Fernhill SCADA.