32.8.1.1 Explanation of the CTU and CTUP Instructions
Counter variables in CTU and CTUP instructions are structure
variables. The following table lists the internal structures.
Counter Variable
Counter Variable
|
Variables Settings
|
Description
|
VariableName.R
|
Bit Variable
|
Resets the current value. Clear (0).
|
VariableName.Q
|
Bit Variable
|
Turns ON when the current value reaches the
preset value.
|
VariableName.UP
|
Bit Variable
|
Counts up when the variable is ON.
|
VariableName.QU
|
Bit Variable
|
For Up/Down counters, turns ON when the current
value reaches the preset value.
|
VariableName.QD
|
Bit Variable
|
For Up/Down counters, turns ON when the current
value reaches 0 or less.
|
VariableName.PV
|
Integer Variable
|
Preset value
|
VariableName.CV
|
Integer Variable
|
Current value
|
When CTU and CTUP instructions are executed, if the counter
reset bit variable .R is OFF, regardless of the preset value .PV,
the current value .CV will increase by 1. When the current value
.CV equals the preset value .PV, the counter output bit variable .Q
turns ON. When the counter reset bit variable .R turns ON, the
current value .CV is reset to zero. The counter output bit variable
.Q also turns OFF.
Program Example
CTU
In the following example, if five operation errors are counted
within 1 minute, an error will be displayed.
In the program example, the timer instruction is not shown. Only
the one-minute timer start trigger for timer start is shown.
To count operation errors, create a separate error input
trigger.
-
When the normally open instruction of the
one-minute timer turns ON, the OUT instruction assigned to counter
.R (reset) turns ON. When the operation error counter .R (reset)
turns ON, the operation error counter .CV of the CTU instruction is
cleared to zero.
-
When the positive transition normally open
instruction in rung 3 turns ON, the operation error counter .CV
value (current value) increases by 1.
-
When the operation error counter .CV value (current
value) equals the .PV value (preset value), the operation error
counter .Q of the CTU instruction turns ON , and the OUT
instruction in rung 4 outputs the error detection message.
CTUP
The difference between CTU and CTUP instructions is whether the
.CV value increases as a level counter, or as a positive transition
counter.
The difference in program creation is that a positive transition
normally open instruction located on rung 3 to detect operation
errors is a normally open instruction.
There is no difference in operation other than how the input is
determined.
|