Timers in Codesys – Timer ON, Timer OFF, Pulse Timer

Codesys is a widely used platform in industrial automation systems. Codesys is an open platform framework that has it’s own set of design screens, function blocks, symbols, syntax, and other formats.

Many popular automation vendors like Schneider Electric and Mitsubishi Electric implement this platform in their range of PLCs. One of the most used instructions in any programming language is a timer.

Timers in Codesys

Any timer that is used in the Codesys platform has the following types of inputs and outputs – IN, PT, Q, and ET. IN and PT are the input pins and Q and ET are the output pins. IN is the input where the timer condition is linked to turn it on or off.

PT is the setpoint of the timer (means how much time the timer should run). Q is the output bit of the timer which turns on when the timer action is completed. ET is the elapsed value of the timer (means the current time running in the timer). These 4 pins are the ones you will find common in any of the timers used in Codesys.

One thing to note is that the setpoint and elapsed time here are in time format, not real or double integer formats as used in other PLC platforms. Time format means the timer values work in milliseconds. So, if you want to run the timer for 1 second, then the input format will be t#1s or t#1000ms.

In this way, you get to define the exact time with accuracy as per your requirements. If you want to write the setpoint from HMI or SCADA, where time format is not supported, you will have to use an integer or a double integer in graphics and use an integer-to-time conversion block in PLC. If you have to show the timer’s current value in graphics, you have to use the time to integer conversion block in PLC.

Types of Timers in Codesys

The main timer instructions used in CodeSys are TON, TOF, and TP.

TON (Timer On)

The Timer-On type is an on-delay timer. It means that when the input is received, the output turns on after the set time elapses. In between, if the input goes false, then the timer’s current value too becomes zero.

TON Timer in CodeSys

As long as the input condition is true, the timer will work. If the input is true and the set time elapses, then the output remains true as long as the input is true.

TOF (Timer Off)

The Timer-Off type is an off-delay timer. It means that when the input is received, the output turns on. When the input goes off, then the timer starts and after the set time elapses, the output goes off.

TOF Timer in CodeSys

In between if the input goes true, then the timer’s current value too becomes zero and the output remains on. As long as the input condition is false after the true condition, the timer will work. If the input is false and the set time elapses, then the output goes false.

TP (Pulse Timer)

The TP timer type is a pulse delay timer. It means that when the input is received as a positive pulse or negative pulse, the output turns on for the set time. After the set time elapses, then the output goes false.

TP Timer in CodeSys

In between, whatever be the condition of the input, the timer will remain on till the set timer elapses and during that time, the output too will remain on. That means it is a latch-type instruction.

If you liked this article, then please subscribe to our YouTube Channel for Instrumentation, Electrical, PLC, and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

Read Next:

Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address

Leave a Comment

Share via
Follow us and never miss an update!