Count Up (CTU)

The CTU instruction counts upward each time the rung-condition-in transitions from false to true.
When rung-condition-in is set to true and .CU is false, ACC will be incremented by one. When rung-condition-in is false, .CU will be cleared to false.
RSL5K_CTU_Count Up
Available Languages
Ladder Diagram
Ladder Diagram_Count Up (CTU)_v1
Operands
IMPORTANT:
Unexpected operation may occur if:
  • Output tag operands are overwritten.
  • Members of a structure operand are overwritten.
  • Except when specified, structure operands are shared by multiple instructions.
Ladder Diagram
Operand
Data Type
Format
Description
Counter
COUNTER
tag
Counter structure
Preset
DINT
immediate
Value of Counter.PRE.
Accum
DINT
immediate
Value of Counter.ACC.
COUNTER Structure
Mnemonic
Data Type
Description
.CU
BOOL
The count up enable contains rung-condition-in when the instruction was last executed.
.DN
BOOL
The done bit when set indicates the counting operation is complete.
.OV
BOOL
The overflow bit when set indicates the counter incremented past the upper limit of 2,147,483,647.
.UN
BOOL
The underflow when set indicates the counter decremented past the lower limit of -2,147,483,648.
.PRE
DINT
The preset value specifies the value which the accumulated value must reach before the instruction indicates it is done.
.ACC
DINT
The accumulated value specifies the number of transitions the instruction has counted.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See Index through arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
The .CU bit is set to true to prevent invalid increments during the first program scan.
Rung-condition-in is false
Set Rung-condition-out to Rung-condition-in
See CTU Flow Chart (False)
Rung-condition-in is true
Set Rung-condition-out to Rung-condition-in
See CTU Flow Chart (True)
Postscan
N/A
CTU Flow Chart (False)
CTU Flow Chart False
CTU Flow Chart (True)
CTU Flow Chart True
Example
Ladder Diagram
FTStudio-CTU-LD-EX-V1
After limit_switch_1 goes from disabled to enabled 10 times, the .DN bit is set to true and light_1 turns on. If limit_switch_1 continues to go from disabled to enabled, counter_1 continues to increment its count and the .DN bit remains set. When limit_switch_2 is enabled, the RES instruction resets counter_1 (clears the status bits and the .ACC value) and light_1 turns off.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.