CTD is a standard function block that decrements a counter value. A rising edge on the CD input reduces the current counter value CV by one, and LOAD set to TRUE loads CV with the start value PV. The output Q is TRUE when CV equals zero.
| Language | structured text |
|---|---|
| Code | CTD |
| Group | Counter |
| Syntax | CTDInst(CD:=VarBOOL1, LOAD:=VarBOOL2, PV:=VarWORD1); |
| Dialect | CODESYS |
| Name | Data type | Description |
|---|---|---|
| CD | BOOL | Rising edge: decrementing CV by one |
| LOAD | BOOL | TRUE: Set CV to the start value PV |
| PV | WORD | Start value for decrementing |
| Q | BOOL | TRUE if CV = 0 |
| CV | WORD | Current counter value |