Tag Archives: plc timer function

What is the function of a PLC timers

PLC timers

PLC timers is a function that we often use when programming with PLC. In programming applications, we can often use timer to realize delay start function and alarm protection function. Moreover, the use of the timer is similar to the time relay in the relay control circuit, so it is easy to use, but is such a simple application, can you use it well?

Let’s take a look at a program. This is a program sent to me by a student. He did a marquee program while practicing programming. He chose a 10ms timer to do it, but found that the marquee program does not execute. Ask me what is the reason? The program is as follows:

This is a very simple program, but it is such a simple program. When the ROL_B instruction is not executed at the time of execution, then where does the problem occur? Can you see what is the reason? What should I do? .

In fact, this situation is mainly due to the use of the timer, the understanding of the timer refresh mode is unclear, the S7-200 series PLC has three resolution timers, each resolution of the timer, its refresh The way is different. So what is the refresh of the timer? Personal understanding is the update of the current value of the timer.

The 1ms timer refreshes the timer every 1ms. The 10ms timer is the refresh of the timer at the beginning of each scan cycle. The refresh of the two resolution timers has nothing to do with the program scan of the PLC. In the case of a 100ms timer, it is refreshed each time a timer instruction is executed.

Cause Analysis:

The 10ms timer is used in this program. Then, the 10ms timer and this program are taken as an example to explain why the following ROL_B instruction is not executed. As shown, we divide the program into three parts, a, b, and c.


a is the start of the scan of the PLC program. The program uses a 10ms timer, then the PLC refreshes the current value of the timer at a, assuming that the current value of the refreshed timer is exactly equal to 10. When the program is executed to b, if M0.0 is ON. We know that the operation of the on-delay timer is when the current value of the timer is equal to the set, the contact of the timer is activated, and the current value of the timer is reset to 0 when the driving condition of the timer is turned off. Therefore, the T33 normally closed contact here is to be operated (because the current value of the timer has been updated at a, and the updated value is equal to 10 equal to the preset value of the timer), then The driving condition of the timer is turned off and the timer is reset to 0. When the program executes to c, because the current value of the timer is equal to 0, the T33 contact above the instruction is not closed, so the following ROL_B instruction is not executed.

Solution:

(1) Replace the 10ms timer with a 100ms resolution timer, because the 100ms resolution timer is to be refreshed when the program executes to the timer command.

(2) Refer to an intermediate variable, and the program is changed as shown below to ensure that the timer is reset after the ROL_B instruction is executed first.