2 Instruction Descriptions
2-134
NJ-series Instructions Reference Manual (W502)
CTD
The CTD instruction decrements the counter value when the counter input signal is received. The pre-
set value and counter value must have an INT data type.
The CTD instruction creates a down counter. The preset value and counter value must have an INT
data type.
When load signal Load changes to TRUE, counter value CV is set to the value of preset value PV and
counter output Q changes to FALSE. When counter input signal CD changes to TRUE, CV is decre-
mented. When the value of CV reaches 0 or less, the value of Q changes to TRUE.
After the value of CV reaches 0 or less, CV does not change even if CD changes to TRUE.
CD is ignored while Load is TRUE. CV is not decremented.
Instruction Name FB/FUN Graphic expression ST expression
CTD Down-counter FB CTD_instance (CD, Load,
PV, Q, CV);
Variables
Name Meaning I/O Description Valid range Unit Default
CD Counter
input
Input
Counter input
Depends on data type.
---
FALSE
Load Load signal TRUE: Set CV to PV.
PV Preset
value
Counter preset value 0 to 32767 0
Q Counter
output
Output
TRUE: Counter output ON
FALSE: Counter output OFF
Depends on data type.
--- ---
CV Counter
value
Counter present value 0 to 32767
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
CD OK
Load OK
PV OK
QOK
CV OK
Function
CTD
CD Q
Load CV
PV
CTD_instance