2-143
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Counter Instructions
2
CTUD
The CTUD instruction creates an up-down counter that operates according to an up-counter input sig-
nal and a down-counter input signal. It has the functions of both an up counter and a down counter. The
preset value and counter value must have an INT data type.
When reset signal Reset changes to TRUE, counter value CV changes to 0 and up-counter output QU
changes to FALSE. When up-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 QU changes to TRUE. After the value of CV
reaches the value of PV or higher, the value of CV does not change even if the value of CU changes to
TRUE.
When load signal Load changes to TRUE, counter value CV changes to the value of preset value
PV and down-counter output QD changes to FALSE. When down-counter input signal CD changes to
TRUE, CV is decremented. When the value of CV reaches 0 or less, the value of QD changes to TRUE.
After the value of CV reaches 0 or less, CV does not change even if CD changes to TRUE.
CU and CD are ignored while Load and Reset are TRUE. CV is not incremented or decremented. If
both CU and CD change to TRUE at the same time, CV will not change. If Reset and Load are both
TRUE, Reset has priority and the value of CV changes to 0. If Reset changes to TRUE, CV changes to
0, and so QD changes to TRUE. If Load changes to TRUE, the value of CV changes to PV, and so QU
changes to TRUE.
PV OK
QU OK
QD OK
CV OK
Function
Operation as an Up Counter
Operation as a Down Counter
Common Operation for Up and Down Counters
Boolean
Bit string 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