Sign in to follow this  
Followers 0
Shamus

Timers

5 posts in this topic

Hello All Does anyone out there have any sample IEC code for an 'On Delay' timer. I know this is simple stuff but there are a couple of crazy things happening in my code and I just want to eliminate from my enquiries. What i'm after is a bit of code that will show the following on e.g an HMI On Delay Timer Timer Enable Signal (Bool) Timer Timing Signal (Bool) Timer Complete Signal (Bool) Preset Time Value (Variable? Type?) Elapsed Time Value (Variable? Type?) I would like to be able to see which Function has been used, what the header looks like, What the global variables look like and how the Timer is instanced or configured as a timer Number i.e How do I insert the function and tell the PLC its Timer1. regards Shamus

Share this post


Link to post
Share on other sites
I assume by an ON DELAY Timer, you mean one which times then turns on a bit when it's timed out? If so, the graphic attached may help. Cheers.

Share this post


Link to post
Share on other sites
Or you use the TON which is exacltly for this prupose. Edited by Gambit

Share this post


Link to post
Share on other sites
Thanks very much for your time Colin thats exactly what I was after and has made things alot clearer. regards Shamus I have actually been using the TON and not the TIMER_M so far but i've been entering the timer setpoint in the format of T#60s (which I assume you don't have to with the TIMER_M function). I have a D(n) showing elapsed time but if I monitor the D(n) it counts up to 32767 then starts counting down from -32727 with a negative value and this is showing up on my HMI which I don't want. regards Shamus

Share this post


Link to post
Share on other sites
I must admit to sticking with tried and trusted functions whenever I can ... at 1 am, my brain can only deal with simple things, and it's no fun being stuck on a PLC with production screaming at you when you don't know what the problem is. I know that any function with "_M" after it was derived from Mitsubishi code, probably DOS MEDOC, so I tend to trust it implicitly. Any of the "non Mitsubishi IEC functions" are interlopers, which may or may not work (TON = Allen Bradley?). In general, I tend to always use the TIMER_M function, normally picking a timer address that counts in 100 mS, therefore the setpoint is 10 times the number of seconds. As long as I know the timer will count to less than 3,277 seconds (about 54 minutes), then one timer will be fine. If the timer will be less than 108 minutes, then I'll probably cascade two timers and use the same setpoint for each timer, eg, a setpoint of 30,000 = 3,000 secs = 50 minutes, times 2 = 100 minutes. In general I find that's plenty for most of my timer applications. If I need a retentive timer (one that doesn't reset when the enable code goes false) then I'll use a normal counter (CC1) and drive it with the 1 second pulse bit in the PLC. This gives me a retentive timer that can count to 32,767 seconds (546 minutes). If you use the 1 minute PLC pulse to drive it, you can end up with a 546 hr timer, though obviously the resolution is not that good. For "hours run functions", where the PLC is timing the hours run of plant items, I tend to use the DINC_P funtion in conjunction with the PLC one minute pulse. This then gives 32 bit data registers incremeting every time the one minute pulse comes on, meaning that they can go to many thousands of hrs without problem. I know I might be a bit conservative about using functions, but if it ain't broke, don't fix it. I never forget KISS (Keep it simple, stupid) .... it's good for the blood pressure. PS The set point on a TIMER_M would normally be a data register (D) or just put in a whole decimal number. In DOS MEDOC, you had to precede the decimal number with a K but you don't need to in IEC Developer. No doubt you can use other things as well ...... but I never have. Edited by Colin Carpenter

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0