Attention
IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.
CTD¶
Count-down counter. Decrements the counter value CV on each rising edge of
CD. Output Q becomes TRUE when CV reaches or falls below zero.
IEC 61131-3 |
Section 2.5.2.3.3 |
Support |
Supported |
Inputs¶
Name |
Type |
Description |
|---|---|---|
|
|
Count-down input (decrements on rising edge) |
|
|
Load input (loads PV into CV) |
|
|
Preset value |
Outputs¶
Name |
Type |
Description |
|---|---|---|
|
|
Counter output (TRUE when CV <= 0) |
|
|
Current counter value |
Behavior¶
On each rising edge of CD, the counter value CV is decremented by one.
When LD is TRUE, the preset value PV is loaded into CV. The
output Q is TRUE when CV is less than or equal to zero.
Typed variants CTD_DINT, CTD_LINT, CTD_UDINT, and CTD_ULINT
use the corresponding integer type for PV and CV.
Example¶
This example loads the preset value into the counter. After loading, CV is
3 which is above zero, so expired is FALSE.