CTU (count up)

The CTU instruction counts (integers) from 0 up to a given value, one by one.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
CTU
CTU
CTU parameters
Parameter
Parameter Type
Data Type
Description
CU
Input
BOOL
Counts upward.
  • TRUE: Rising edge detected, count upward in increments of one.
  • FALSE: Falling edge detected, hold the counter value at the same value.
RESET
Input
BOOL
Reset verifies the PV value against the count upward value.
  • TRUE: Set the CV value to zero.
  • FALSE: Continue incrementing count upward by one.
PV
Input
DINT
Programmed maximum value of the counter.
Q
Output
BOOL
Indicates whether the count up instruction has resulted in a number greater than or equal to the maximum value of the counter.
  • TRUE: Counter result => PV (Overflow condition).
  • FALSE: Counter result < PV
CV
Output
DINT
Current counter result.

CTU function block diagram example
CTU ladder diagram example
CTU ladder diagram example
CTU structured text example
CTU structured text example
(* ST Equivalence: CTU1 is an instance of CTU block*) CTU1(trigger,NOT(auto_mode),100); overflow := CTU1.Q; result := CTU1.CV;
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal