CTD (count down)

The CTD instruction counts integers from a given value down to 0, one by one.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
CTD
CTD
CTD parameters
Parameter
Parameter Type
Data Type
Description
CD
Input
BOOL
Counts down.
  • TRUE: Rising edge detected, count down in increments of one.
  • FALSE: Falling edge detected, hold the counter value at the same value.
LOAD
Input
BOOL
Load verifies the PV value against the count down value.
  • TRUE: Set CV = PV.
  • FALSE: Continue incrementing count down by one.
PV
Input
DINT
Programmed maximum value of the counter.
Q
Output
BOOL
Indicates whether the count down instruction has resulted in a number less than or equal to the maximum value of the counter.
  • TRUE: Counter result <= 0 (Underflow condition).
  • FALSE: Counter result > 0.
CV
Output
DINT
Current counter value.

CTD examples

CTD function block diagram example
CTD function block diagram example
CTD ladder diagram example
CTD ladder diagram example
CTD structured text example
CTD structured text example
(*ST Equivalence: CTD1 is an instance of block *) CTD1(trigger,load_cmd,100); underflow := CTD1.Q; result := CTD1.CV;
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal