Looking for a START/STOP Timer that will retain its value in Unity Pro XL

cnemeth

Member
Join Date
Jan 2014
Location
Manitoba
Posts
5
Hi everyone,

My name is Chris and I'm currently in the midst of teaching myself how to program PLCs for my job. I'm currently experimenting with Schneider Electric's Modicon M340 PLC and their associated Unity Pro XL v8.0 programming software. That said, I'm having some trouble trying to finding an appropriate timer for my application. What I'm basically looking for is something that will act as a START/STOP timer that will count up from 0 and retain its value when stopped. It should also have a reset parameter to re-initialize the timer back to 0. I'm wondering if there is a timer that has been designed for this kind of application in the Standard Library? If anyone knows of a Standard Library function that works as specified or how to make one yourself, I'd love to hear from you. Thank you in advance.

Regards,
Chris
 
Solution to my problem

Hey everyone,

So I figured out how to create my own Retentive Start/Stop Timer using a combination of an Off Delay Timer (TOF) and an On Delay Timer (TON). I created an EBOOL variable that emulates a start/stop switch, with 1 for ON and 0 for OFF. This input gets fed into the input of a TOF Timer, which, upon pressing the start/stop button, immediately turns on the output. The output from the TOF timer gets fed into the input of a TON Timer, which then starts counting from 0 seconds to the time specified for the TON timer. When the user presses the start/stop button again to turn it off, power is maintained momentarily to the TON timer so the elapsed time up until the timer was stopped can be recorded. This is made possible by the fact that the off delay timer maintains the on delay timer's activated status upon being deactivated. The power is maintained for as long as the programmer specifies. In my case, I chose 1 second for the off delay timer and 1 minute for the on delay. Depending on the application, however, you could choose whatever duration you want for either parameter. Keep in mind, however, that a long off delay time would mean you'd have to wait longer to use the timer function again, while a shorter on delay duration might result in inaccurate recording if the event you're recording exceeds the specified time.

Regards,
Chris
 
Hi Chris, I saw this post and thought I might add my solution even though you came up with something that works for you.

To solve this problem I took advantage of the fact that a CTU block retains its count when stopped.

To get the CTU block to count time you have to set its CU pin high periodically with each incremental unit step in time (I worked in seconds).

To do this I connected a TON block to the CU input on the CTU. I set the TON PT value to t#1s and then linked its IN and Q pins to have the block continuously count to 1 and then reset. This way, as long as the TON was enabled, the Q pin would continuously pulse high every second.

The CTU block contains a reset pin which is handy.

Cheers,
Matt
 
Hi Chris, I saw this post and thought I might add my solution even though you came up with something that works for you.

To solve this problem I took advantage of the fact that a CTU block retains its count when stopped.

To get the CTU block to count time you have to set its CU pin high periodically with each incremental unit step in time (I worked in seconds).

To do this I connected a TON block to the CU input on the CTU. I set the TON PT value to t#1s and then linked its IN and Q pins to have the block continuously count to 1 and then reset. This way, as long as the TON was enabled, the Q pin would continuously pulse high every second.

The CTU block contains a reset pin which is handy.

Nice solution - I would just suggest using the %S6 status bit in place of your 1 second timer. A 1 second timer is not particularly accurate due to scan time, while the %S6 bit will give you an accurate 1 second cycle time
 
Nice solution - I would just suggest using the %S6 status bit in place of your 1 second timer. A 1 second timer is not particularly accurate due to scan time, while the %S6 bit will give you an accurate 1 second cycle time

My problem is to reset the CV value with an interlock. But "Reset" is not helping as i thought it would reset "CV" value. Can you please help?
 
My problem is to reset the CV value with an interlock. But "Reset" is not helping as i thought it would reset "CV" value. Can you please help?
Not sure what you are doing but a 1 on the reset pin will reset the CV value. That is the point of the reset pin
 
Not sure what you are doing but a 1 on the reset pin will reset the CV value. That is the point of the reset pin
Thanks a lot for quick reply, GeoffC. I'm trying to calculate total time between two conditions. When condition status is 1, I want to start calculating total time until the condition becomes 0. Once it becomes zero, I want to reset CV value to zero. I forced on the reset pin after counter is stopped but it did not make the value of CV to zero. I am doing all these in simulation mode. Would that be a problem? And other thing, CV value keep counting up even pasing the PT value.
 

Similar Topics

can anyone has a good program to learn plc programming online. i have the basic looking into improve my skills thanks
Replies
1
Views
170
I've been doing control systems design and PLC/HMI programming for about 3 years at my current company and I've really come to love it. However...
Replies
17
Views
4,228
Hello All, Please direct me to post to the right page. I am really new to PLC, and want to find a tutor who is familiar with Automation Direct's...
Replies
6
Views
248
Hi , Where i can find Mitsubishi PLC Card end of line & replacement model details. i am looking for Q02CPU replacement model. Please advice. thanks
Replies
2
Views
163
I have Allen Bradley plcs, I have had Circuit breakers and other automation equipment in the past. There's no solid buyers local. How much do you...
Replies
2
Views
235
Back
Top Bottom