Timer Counter Operations for IEC
See also: IEC 61131 Language Editor Programming
See also: Project Toolbox for IEC
Topic Menu
Timer Counter Overview
| Off Delay Timer in IEC |
Off Delay Timer with 100ms resolution |
| Off Delay Timer with 100ms resolution 32 Bit | |
|
Off Delay Timer with 10ms resolution |
|
| Off Delay Timer with 10ms resolution 32 Bit | |
|
Off Delay Timer with 1ms resolution |
|
| Off Delay Timer with 1ms resolution 32 Bit | |
|
Off Delay Timer with 1 Sec resolution |
|
| Off Delay Timer with 1 sec resolution 32 Bit | |
| On Delay Timer in IEC |
On Delay Timer with 100ms resolution |
| On Delay Timer with 100ms resolution 32 Bit | |
|
On Delay Timer with 10ms resolution |
|
| On Delay Timer with 10ms resolution 32 Bit | |
|
On Delay Timer with 1ms resolution |
|
| On Delay Timer with 1ms resolution 32 Bit | |
|
On Delay Timer with 1 Sec resolution |
|
| On Delay Timer with 1 sec resolution 32 Bit | |
| On Delay - Retentive in IEC |
On Delay Timer- Retentive with 100ms resolution |
| On Delay Timer- Retentive with 100ms resolution 32 Bit | |
|
On Delay Timer- Retentive with 10ms resolution |
|
| On Delay Timer- Retentive with 10ms resolution 32 Bit | |
|
On Delay Timer- Retentive with 1ms resolution |
|
| On Delay Timer- Retentive with 1ms resolution 32 Bit | |
|
On Delay Timer- Retentive with 1 Sec resolution |
|
| On Delay Timer- Retentive with 1 sec resolution 32 Bit | |
| On Timer – Retentive (1 sec) | |
| On Timer – Retentive (1 sec) 32 bit | |
| On Timer – Retentive (1 ms) | |
| On Timer – Retentive (1 ms) 32 bit | |
| On Timer – Retentive (10 ms) | |
| On Timer – Retentive (10 ms) 32 bit | |
| On Timer – Retentive (100 ms) | |
| On Timer – Retentive (100 ms) 32 bit | |
Return to the Top: Timer Counter Operations for IEC
Off Delay Timer in IEC
Also called: TOF100mS / TOF10mS / TOF1mS / TOF1Sec - (Res. 32 Bit)
Operator - Performs OFF delay timer operations using these blocks with specified timebase.
Resolution
16 BIT Resolution Timers: The count value limit in these timers is 32767.
32 BIT Resolution Timers: The 32 –bit resolution Timers are useful in applications were the count value needs is insufficient using the regular timers of 16 bit. The count value limit in these timers is 2147483647.
Inputs
IN : Input for resetting Count up time (CT) & enable the output Q. (TYPE : BOOL
Boolean- [Data Type BOOL] - A single bit, binary value, or register/variable. Boolean points have only two possible values, 'TRUE' or 'FALSE'.)
PT : Programmed time, Maximum count up for Count up time (CT). (TYPE : INT)
Outputs
Q : Output which stays TRUE till the count up is active & goes FALSE when CT=PT. (TYPE : BOOL)
CT : The counter for the specified timebase, to reach the Programmed time. (TYPE : INT)
Remarks
-
The timer starts on a falling pulse of IN input. It stops when the Count up time (CT) is equal to the programmed time (PT). A rising pulse of IN input resets the timer to 0. The output signal is set to TRUE when the IN input rises to TRUE, reset to FALSE when programmed time is elapsed for the specified timebase.
-
In LD language, the input rung is the IN command. The output rung is the Q output signal.
-
The timebase is user definable in 10mS or 100mS ticks. When input IN goes high the counting proceeds based on the timebase block used.
ST Language
(* TOF1 is a declared instance of TOF100ms function block *)
TOF1 (IN, PT);
Q := TOF1.Q;
CT := TOF1.CT;
OR
(* TOF1 is a declared instance of TOF10ms function block *)
TOF1 (IN, PT);
Q := TOF1.Q;
CT := TOF1.CT;
FBD Language
LD Language
IL Language
Return to the Top: Timer Counter Operations for IEC
On Delay Timer in IEC
Also called: TON100mS / TON10mS/ TON1mS / TON1Sec – (Res. 32 Bit)
Operator - Performs ON delay timer operations using these blocks with specified time base.
Resolution
16 BIT Resolution Timers: The count value limit in these timers is 32767.
32 BIT Resolution Timers: The 32-bit resolution Timers are useful in applications were the count value needs is insufficient using the regular timers of 16 bit. The count value limit in these timers is 2147483647.
Inputs
IN : Input for starting Count up time (CT).(TYPE : BOOL)
PT : Programmed time, Maximum count up for CT. (TYPE : INT)
Outputs
Q : Output goes TRUE when CT = PT & goes FALSE when input is low. (TYPE : BOOL)
CT : The counter of the timebase specified, to reach the Programmed time. (TYPE : INT)
Remarks
-
The timer starts on a rising pulse of IN input. It stops when the Count up time (CT) is equal to programmed time (PT). A falling pulse of IN input resets the timer to 0. The output signal is set to TRUE when programmed time is elapsed, and reset to FALSE when the input command falls.
-
In LD language, the input rung is the IN command. The output rung is Q the output signal.
-
The timebase is user definable in 10mS or 100mS "ticks". When input IN goes high the counting proceeds based on the timebase block used.
ST Language
(* TON1 is a declared instance of TON100ms function block *)
TON1 (IN, PT);
Q := TON1.Q;
CT := TON1.CT;
OR
(* TON1 is a declared instance of TON10ms function block *)
TON1 (IN, PT);
Q := TON1.Q;
CT := TON1.CT;
FBD Language
LD Language
IL Language
Return to the Top: Timer Counter Operations for IEC
On Delay - Retentive in IEC
Also called: TONR100mS / TONR10mS / TONR1mS / TONR1Sec – (Res. 32 Bit)
Operator - Performs retentive ON timer operations using these blocks.
Resolution
16 BIT Resolution Timers: The count value limit in these timers is 32767.
32 BIT Resolution Timers: The 32 –bit resolution Timers are useful in applications were the count value needs is insufficient using the regular timers of 16 bit. The count value limit in these timers is 2147483647.
Inputs
IN : Timer command. (TYPE : BOOL)
RESET : For resetting the counter CT & output Q. (TYPE : BOOL)
PT : Preset time, Maximum count up for CT. (TYPE : INT
Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767.)
Outputs
Q : Output goes TRUE when CT = PT & goes FALSE when reset is pressed (TYPE : BOOL)
CT : The counter of the timebase specified, to reach the Programmed time. Set to zero if reset is pressed. (TYPE : INT )
Remarks
A Retentive On Delay Timer is a special case of the "standard" On Delay Timer. It differs from the standard timer in that the Retentive Timer does not reset when the input is brought inactive (off). The Retentive Timer requires that a reset signal be applied to the element in order for the timer to be reset.
ST Language
(* TONR1 is a declared instance of TONR100ms function block *)
TONR1 (IN, PT);
Q := TONR1.Q;
CT := TONR1.CT;
OR
(* TONR1 is a declared instance of TONR10ms function block *)
TON1 (IN, PT);
Q := TONR1.Q;
CT := TONR1.CT;
FBD Language
LD Language
IL Language
Return to the Top: Timer Counter Operations for IEC
On Timer – Retentive (Applicable to Enhanced IEC only)
From Cscape Ver 10.2 SP1 and FW 17.40 (XLPrime and Canvas models), new On timer – retentive blocks are supported.
Also called as: RTON1SEC/ RTON1ms/ RTON10ms/ RTON100ms – (Res 32-Bit)
Operator - The Retentive On-Delay Timer operates similarly to a standard On-Delay Timer, with one key difference; The timer does not reset when the input signal turns OFF, when the device restarts, or when the controller transitions between operating modes (IDLE → RUN).
- A Retentive Timer resets only when an explicit Reset signal is applied to the timer element.
Resolution
16 BIT Resolution Timers: The count value limit in these timers is 32767.
Inputs
IN (Input): - BOOL
RST (Reset): - BOOL
PT (Preset Time): - INT
CV (Current Value): - INT
Outputs
Q (output): - BOOL
CT (Current Time): - INT
32 BIT Resolution Timers: The count value limit in these timers is 2147483647
Inputs
IN (Input): - BOOL
RST (Reset): - BOOL
PT (Preset Time): - DINT
CV (Current Value): - D INT
Outputs
Q (output): - BOOL
CT (Current Time): - DINT
Retention of CT (Current Time) Using CV (Current Value) Variable
To preserve the timer’s Current Time (CT) across power cycles or mode transitions, the timer uses an associated Current Value (CV) variable.
CV is Read only variable.
-
The CV variable must be created in the Retain Variable window to ensure the CT value is retained after:
-
A full power cycle
-
A transition from IDLE to RUN
-
-
If the CV variable is created in the Global Variable window, the CT value will not be retained after power cycle or mode change.
PT (Preset Time), CT (Current Time), and CV (Current Value) Variable Requirements
-
CV Variable
-
Must be created as a Retain variable for CT retention.
-
CV stores the last known timer value. When a restart or IDLE → RUN transition occurs, CT resets to zero, and the stored CV value is automatically restored back to CT.
-
-
CT Variable
-
Can be created in either Global or Retain variable windows.
-
CT retention behavior depends on how the CV variable is configured.
-
-
PT Variable
-
If the preset time must persist after power cycle or mode change, PT should be created in the Retain Variable window.
-
CT Restoration Mechanism
During a restart or when transitioning from IDLE to RUN:
-
The CT register initializes to zero.
-
The system then reads the value stored in CV (if CV is configured as Retain).
-
The CT value is automatically restored from CV.
-
Timer operation continues from the retained value rather than restarting from zero.
LD Language
FBD Language
IL Language
ST Language
Return to the Top: Timer Counter Operations for IEC