2 Instruction Descriptions
2-140
NJ-series Instructions Reference Manual (W502)
CTU_**
The CTU_** instruction increments the counter value when the counter input signal is received. The
preset value and counter value must be one of the following data types: DINT, LINT, UDINT, or ULINT.
* Negative numbers are excluded.
A CTU_** instruction creates an up counter. The preset value and counter value must be one of the fol-
lowing data types: DINT, LINT, UDINT, or ULINT. The name of the instruction is determined by the data
type of PV and CV. For example, if they are the LINT data type, the instruction is CTU_LINT.
When reset signal Reset changes to TRUE, counter value CV changes to 0 and counter output Q
changes to FALSE. When counter input signal CU changes to TRUE, CV is incremented. When the
value of CV reaches the value of PV or higher, the value of Q changes to TRUE.
Instruction Name FB/FUN Graphic expression ST expression
CTU_** Up-counter Group FB CTU_**__instance (CU,
Reset, PV, Q, CV);
"**" must be DINT, LINT,
UDINT, or ULINT.
Variables
Name Meaning I/O Description Valid range Unit Default
CU Counter
input
Input
Counter input
Depends on data type.
---
FALSE
Reset Reset
signal
TRUE: Reset CV to 0.
PV Preset
value
Counter preset value Depends on data type.* 0
Q Counter
output
Output
TRUE: Counter output ON
FALSE: Counter output OFF
Depends on data type.
--- ---
CV Counter
value
Counter present value Depends on data type.*
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
CU OK
Reset OK
PV OK OK OK OK
QOK
CV Must be the same data type as PV
Function
"**" must be DINT, LINT, UDINT,
or ULINT.
CTU_**
CU Q
Reset CV
PV
CTU_**_instance