{"id":"iec-ctu","model_id":"CTU","name":"CODESYS CTU","summary":"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.","study_notes":[],"safety_notes":[],"sources":[{"url":"https://infosys.beckhoff.com/content/1033/tcplclib_tc2_standard/74400523.html","title":"Beckhoff Information System","accessed":"2026-10-26"},{"url":"https://content.helpme-codesys.com/en/libs/Standard/Current/Counter/CTU.html","title":"CODESYS Group","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":18,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"iec_61131_3","code":"CTU","group":"Counter","syntax":"CTUInst( CU := VarBOOL1, RESET :=VarBOOL2 , PV := VarWORD1);","parameters":[{"name":"CU","data_type":"BOOL","description":"Rising edge: Incrementing CV by one"},{"name":"RESET","data_type":"BOOL","description":"TRUE: Reset CV to 0"},{"name":"PV","data_type":"WORD","description":"Upper limit for incrementing"},{"name":"Q","data_type":"BOOL","description":"TRUE if CV >= PV"},{"name":"CV","data_type":"WORD","description":"Current counter value"}],"dialect":"CODESYS","related":[],"standards":[]},"url":"https://machineschema.com/instruction/iec-ctu","license":"https://creativecommons.org/licenses/by/4.0/"}