Starting/stopping TON timer

Jozir

Member
Join Date
May 2018
Location
Vlaams-Brabant
Posts
55
Hello everyone,

Is it possible to stop a TON timer using the same input that you used to start the timer with?

PLC used s7 1200
Software TIA v13
 
Do you need a timer to retain the value it has "timed" when you remove the signal?

If so TON is the wrong function to use.
 
Do you need a timer to retain the value it has "timed" when you remove the signal?

If so TON is the wrong function to use.

Not really the answer I was looking for but you can retain the value of a timer by moving the elapsed time into a variable isn't that correct?
 
With a little bit of code and a couple of other memory bits. You could have that one physical input doing whatever you like.
 
Not really the answer I was looking for but you can retain the value of a timer by moving the elapsed time into a variable isn't that correct?

You could do, but long winded when there's inbuilt re tentative timers.

Break down exactly what you are trying to achieve as I'm not sure I understand what you're trying to do.
 
Just latch a bit with i0.0 and unlatch with i0.1, that bit is your TON.IN

EDIT: Use TONR if you need to accumulate, TON if you don't.

KISS
 
You could do, but long winded when there's inbuilt re tentative timers.

Break down exactly what you are trying to achieve as I'm not sure I understand what you're trying to do.

I need a speed measurement for a foosball tabel. I've got one sensor 20cm infront of the goal and one sensor in the goal. ( already have correct speed measurement but no direction detection)

Start timer when first sensor crossed.
Stop timer when 2nd sensor crossed.

BUT when the ball bounces next to the goal, 1st sensor gets crossed 2 times in a row and timer will still be running -> result: speed measurement wrong.

I have to prevent this :
https://ibb.co/gz07f8

I currently set the time with sensor field 1 and reset timer with sensor goal 1 or sensor field 2.
 
I need a speed measurement for a foosball tabel. I've got one sensor 20cm infront of the goal and one sensor in the goal. ( already have correct speed measurement but no direction detection)

Start timer when first sensor crossed.
Stop timer when 2nd sensor crossed.

BUT when the ball bounces next to the goal, 1st sensor gets crossed 2 times in a row and timer will still be running -> result: speed measurement wrong.

I have to prevent this :
https://ibb.co/gz07f8

I currently set the time with sensor field 1 and reset timer with sensor goal 1 or sensor field 2.

Are you trying to restart the timer in the same scan you stop it? If so, I think you can call the TON instruction twice, with the same instance data block each time. The first time you give IN a false, the second time you give it a true. That way the block sees a rising edge and resets itself.
 
Split the task down.

The first part, you need something that holds when the first input operates and releases when the second one operates. You can do this with a bit either M memory or a bit from a word on DB memory, you can Set and Reset the bit, or create a self-holding circuit that opens when the second input operates. You also need to have it reverse proofed so that if input 2 operates first then it ignores the input 1, again by using a latching system.

Once you have that bit sorted then you can look at the timer. A TON timer looses its value when you remove the enable signal, so if you use a TON timer you will have to grab the elapsed time before you loose the enable signal. If you use a TONR timer then the time will be held when you loose the enable signal, but you will have to reset the timer at some point. You could reset manually through another input or timeout, or you could use a rising edge (P_TRIG) to reset the timer when the first input operates.

The problem you have using standard inputs is that you limited by how quickly the PLC will see that the input has changed which involves the cycle time of the PLC which will be low milliseconds. The other limit is that standard timers have a minimum resolution in milliseconds.
 
Are you trying to restart the timer in the same scan you stop it? If so, I think you can call the TON instruction twice, with the same instance data block each time. The first time you give IN a false, the second time you give it a true. That way the block sees a rising edge and resets itself.

You mean this? : https://ibb.co/khHp2y

This looks pretty weird :p
 
Once you have that bit sorted then you can look at the timer. A TON timer looses its value when you remove the enable signal, so if you use a TON timer you will have to grab the elapsed time before you loose the enable signal. If you use a TONR timer then the time will be held when you loose the enable signal, but you will have to reset the timer at some point. You could reset manually through another input or timeout, or you could use a rising edge (P_TRIG) to reset the timer when the first input operates.
.

I understand what you're saying here and I already solved the problem with the ET dropping when you lose the enable signal by moving the elapsed time in a variable using a move block.

My question remains is it possible to reset that timer when I get 2 straight signals on the input that sets the timer? Like I show in my picture, I know this is wrong but there must be a way, right?

https://ibb.co/mQOU2y
 
You mean this? : https://ibb.co/khHp2y

This looks pretty weird :p

Agreed, definitely looks weird. I can't recall if I've done it with a timer before or not, but I know I've done it with motion instructions, communication instructions, etc. I'd recommend testing to ensure it doesn't somehow double count, just to be sure. If it ends up working for you, I'd strongly recommend some comments in your code to explain what you're trying to do there.

I'm not 100% sure on the conditions pointing to the IN, but I think that's the right idea. It makes sense when conditions will be such that the first call will be false, ending the last timer and the 2nd call will be true, starting the timer again, immediately.
 

Similar Topics

Hi Guys, I'm using an ABL33ER with Panelview 600. I have datalogging running on the HMI using the view studio datalog model on startup of the...
Replies
4
Views
1,136
Hello everyone! I was wondering if anyone has a program in rslogix/studio 5000 for this type of application that could share. Basically there...
Replies
5
Views
2,426
hi, i need to make Step 7 program which will make possible to start and stop pump by pressing a button on HMI touch panel.I first need to connect...
Replies
7
Views
3,355
Hey guys and gals, I have a question about programming 3 conveyors in sequence each starting seconds apart and when the stop button is hit...
Replies
31
Views
17,392
Hi All, What would be the cause of heavy jerking of our crane during long travel operation? Here is the scenario; The time I issued a command...
Replies
31
Views
11,823
Back
Top Bottom