TOFR — Off-Delay Timer
Structured Text off-delay timer function block. Uses FBD_TIMER; the ST equivalent of ladder TOF.
Operands
| Name | Type |
|---|---|
timer | FBD_TIMER |
FBD_TIMER Tag Members
| Member | Type | Meaning |
|---|---|---|
.EnableIn | BOOL | 1 lets the instruction run; 0 holds all outputs unchanged. Normally 1. |
.TimerEnable | BOOL | 1 runs the timer and advances ACC; 0 stops timing |
.PRE | DINT | Preset target time in milliseconds |
.Reset | BOOL | 1 clears EN, TT, DN and sets ACC to 0 |
.EnableOut | BOOL | 1 while the instruction is executing normally |
.ACC | DINT | Accumulated time in milliseconds |
.EN | BOOL | 1 while TimerEnable is 1 and Reset is 0 |
.TT | BOOL | 1 while the timer is actively counting toward PRE |
.DN | BOOL | Done status — each timer (TONR, TOFR, RTOR) decides when this turns on |
.Status | DINT | Packed status word — combines InstructFault and PresetInv bits |
.InstructFault | BOOL | 1 when the instruction hit an execution error |
.PresetInv | BOOL | 1 when PRE is outside its valid range |
How It Works
TOFR is the Structured Text function-block equivalent of the ladder TOF instruction. It operates on an FBD_TIMER tag.
.DN holds 1 while TimerEnable is 1, and remains 1 for the preset duration after TimerEnable drops to 0.
Example
ExhaustTimer.TimerEnable := MachineRunning;
ExhaustTimer.PRE := 30000;
TOFR(ExhaustTimer);
ExhaustFan := ExhaustTimer.DN;
Common Mistakes
- Setting
.EnableIn := 0to pause the timer.EnableIn = 0freezes all outputs —.ACC,.EN,.TT,.DN— without advancing them. To stop timing, drop.TimerEnableto0instead and leave.EnableInat1.