2 Instruction Descriptions
2-136
NJ-series Instructions Reference Manual (W502)
CTD_**
The CTD_** instruction decrements 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 CTD_** instruction creates a down counter. The preset value and counter value must be one of the
following 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 CV data type, the instruction is CTD_LINT.
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.
Instruction Name FB/FUN Graphic expression ST expression
CTD_** Down-counter
Group
FB CTD_**_instance (CD,
Load, PV, Q, CV);
"**" must be DINT, LINT,
UDINT, or ULINT.
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 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 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
CD OK
Load OK
PV OK OK OK OK
QOK
CV Must be the same data type as PV
Function
"**" must be DINT, LINT, UDINT,
or ULINT.
CTD_**
CD Q
Load CV
PV
CTD_**_instance