# CODESYS CTU

Instructions · `CTU` · verification: source checked

CTU is a function block that increments a counter value. A rising edge on CU increases CV by one, RESET=TRUE sets CV to 0, and PV sets the upper limit for incrementing. Output Q is TRUE when CV is greater than or equal to PV.

## Specification

| Property | Value |
|---|---|
| Language | iec 61131 3 |
| Code | CTU |
| Group | Counter |
| Syntax | CTUInst( CU := VarBOOL1, RESET :=VarBOOL2 , PV := VarWORD1); |
| Dialect | CODESYS |

### Parameters

| Name | Data type | Description |
|---|---|---|
| CU | BOOL | Rising edge: Incrementing CV by one |
| RESET | BOOL | TRUE: Reset CV to 0 |
| PV | WORD | Upper limit for incrementing |
| Q | BOOL | TRUE if CV >= PV |
| CV | WORD | Current counter value |

## Sources

1. [Beckhoff Information System](https://infosys.beckhoff.com/content/1033/tcplclib_tc2_standard/74400523.html) (accessed 2026-10-26)
2. [CODESYS Group](https://content.helpme-codesys.com/en/libs/Standard/Current/Counter/CTU.html) (accessed 2026-10-26)

---

Source page: https://machineschema.com/instruction/iec-ctu  
JSON: https://machineschema.com/instruction/iec-ctu.json  
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite Machine Schema and the original sources.
