CTD

CTD 1:

The CTD function block is a down counter.

If LOAD = TRUE, the counter variable CV is initialized with the upper limit PV. If the CD input has a rising edge from FALSE to TRUE, the counter variable CV is reduced by one as long as CV is greater than zero. If the counter variable CV reaches the value zero, the Q output is set to TRUE.

CTD 2: Inputs

VAR_INPUT
    CD   : BOOL; (* Count Down on Rising Edge *)
    LOAD : BOOL; (* Load Start Value *)
    PV   : WORD; (* Start Value *)
END_VAR

Name

Type

Description

CD

BOOL

On a rising edge: count down by one

LOAD

BOOL

TRUE: Set counter variable CV to the start value PV

PV

Word

Start value

CTD 3: Outputs

VAR_OUTPUT
    Q  : BOOL; (* Counter reached 0 *)
    CV : WORD; (* Current Counter Value *)
END_VAR

Name

Type

Description

Q

BOOL

TRUE if the counter value CV is 0.

CV

WORD

Counter variable (current counter value)

Requirements

Development environment

Target platform

PLC library to include

TwinCAT v3.0.0

PC or CX (x86)

Tc2_Standard