Timers

Navigation:  Libraries > CT Standard >

Timers

Previous pageReturn to chapter overviewNext page
TOFF_RET
TON_RET

 

TOFF_RET

 

This Off-Timer function block is used to delay a negative edge transition. The output Q goes TRUE as soon as IN goes TRUE. When IN changes from TRUE to FALSE, Q will remain TRUE for the time set by PT before going FALSE. ET is set to the elapsed time since IN went FALSE.

If IN returns TRUE, ET is suspended and will only continue when IN goes FALSE again. A rising edge on RESET will reset the timer, i.e., ET will be cleared to zero.

 

Inputs:

 

IN : BOOL; Input. Falling edge starts counting up ET.

 

PT : TIME; Preset time delay. Upper limit for counting up ET.

 

RESET : BOOL; When set TRUE, ET is cleared to zero.

 

Outputs:

 

Q : BOOL; Output. Set TRUE when IN is TRUE. Set FALSE when ET reaches PT or the RESET input is set TRUE.

 

ET : TIME; Elapsed time. Starts when IN goes FALSE. Cleared when PT has expired or RESET is set TRUE.

 

The following diagram shows the relationship between the inputs and outputs.

TOFF_RET

 

Declaration example:

 

TOFF_RETInst : TOFF_RET;

 

 

Example in FBD:

 

TOFF_RET_FBD

 

 

Example in ST:

 

TOFF_RETInst(IN := VarBOOL1, PT:= T#5s, RESET := VarBOOL2);

 

VarBOOL3 := TOFF_RETInst.Q;

VarTIME := TOFF_RETInst.ET;

 

 

 

TON_RET

 

This On-Timer function block is used to delay a positive edge transition. When IN changes from FALSE to TRUE, the output Q goes TRUE after the time period set by PT. ET is set to the elapsed time since IN went TRUE.

If IN returns FALSE, Q is set FALSE and ET is suspended, and will only continue when IN goes TRUE again. A rising edge on RESET will reset the timer, i.e., ET will be cleared to zero.

 

Inputs:

 

IN : BOOL; Input. Rising edge starts counting up ET.

 

PT : TIME; Preset time delay. Upper limit for counting up ET.

 

RESET : BOOL; When set TRUE, ET is cleared to zero.

 

Outputs:

 

Q : BOOL; Output. Set TRUE when IN is TRUE and PT has elapsed. Set FALSE if IN goes FALSE or the RESET input is set TRUE.

 

ET : TIME; Elapsed time. Starts when IN goes TRUE. Cleared when PT has expired or RESET is set TRUE.

 

The following diagram shows the relationship between the inputs and outputs.

TON_RET

Note: The TON_RET block must be executed at least once with IN set FALSE, after the module has initialised. If IN is TRUE when the block is run for the first time after module initialisation , the output may go TRUE before the specified delay time, PT. This is because the initial time used to calculate the elapsed time has not been set and may therefore contain a value of zero.

 

Declaration example:

 

TON_RETInst : TON_RET;

 

 

Example in FBD:

 

TON_RET_FBD

 

 

Example in ST:

 

TON_RETInst(IN:= VarBOOL1, PT:= T#5s, RESET := VarBOOL2);

 

VarBOOL3 := TON_RETInst.Q;

VarTIME := TON_RETInst.ET;