Posted 29 Feb 2008 Hi Guys I would like to put a timer on the plc inputs to see how long the are running. Because I am using 6 inputs I don't want to setup 4 T4's. does the ML1100 have a true 1 second bit that i could use after the inputs and use a counter to count the second pulses.. I know that the ML1200 does not have a true second bit. Regards Andrea Share this post Link to post Share on other sites
Posted 29 Feb 2008 Even if there is a 'true 1 second bit' it probably won't be synchronous with the actuation of the input. If you use counters it's going to be just as much of a chore as timers. Share this post Link to post Share on other sites
Posted 29 Feb 2008 (edited) Bob is right Andrea, it won't be synchronous with the process, but, what you are asking about is possible. The quick and dirty way is to program a one second timer that resets itself once every second. XIO T4:0/DN TON T4:0 .01 100 0 But this still won't be exactly once every second, each time the timer completes, the actual time is the timer preset plus the amount of scan time it took the PLC to get back to the timer insturction, and that becomes part of the total time we have counted. So the trick is to generate a pulse that can be used in a scan that will still occur once every second +/- the time of the indivual scan. But the next one will still be at the next second mark from when we started, not at the next second from when we got around to resetting the timer. The built in free running timer is nice for that, but it doesn't have a bit that occurs at 1.0 seconds. Let me illustrate it this way. Suppose that our self resetting one second timer is consistently scanned in a 10ms long program that repeats the same way every time. So the self resetting timer will give a pulse at time = 1.01, 2.02, 3.03, 4.04, 5.05... so after five seconds its late by 50 milliseconds, and after 100 seconds have actually elapsed we have only counted 99 seconds. If we had a a free running one second timer, we could get a pulse to use in our hypothetical program above at 1.0 +/-.01, 2.0 +/-.01, 3.0 +/-.01, 4.0 +/-.01, 5.0 +/-.01 6.0 +/-.01... Each pulse occurs right on time, +/- the time of a single scan without the accumulating error. After 100 seconds, +/- 10 milliseconds, we have counted 100 seconds. We can construct a free running timer using the LSB of a timer acculator, ie T4:0.ACC/0, but its more programming gynastics to do something that can be accomplished other ways. Because of this reason, it would be be much easier to simply use a timer to time the process instead of first programming a timer and then counting the timer. And it will be more accurate too. If the problem is that the process is longer than 9 hours, 6 minutes (32767 seconds) and you are counting seconds using a 32 bit long or a float, then look at the attached program. It shows a way to count seconds that preserves those few extra milliseconds that otherwise would be lost between when the desired time period actually expires and the instant that the TON insturction is actually scanned and how to deal with that and preserve those extra milliseconds when timing long periods by counting seconds with a float for long. If this doesn't help you then perhaps an explanation of what you are trying to accomplish will help. A030108A.RSS Edited 29 Feb 2008 by Alaric Share this post Link to post Share on other sites
Posted 3 Mar 2008 You may consider STI (timed interrupt) to get a true 1 sec bit without the scan time error. If you are not sure how to use it, we can help you. Share this post Link to post Share on other sites
Posted 3 Mar 2008 The EII is the only interrupt that could be triggered off of an external condition of an input, but you only have 4 of them on the 1100 Share this post Link to post Share on other sites
Posted 3 Mar 2008 Good idea! I use STI interrupt in many project, so I didn't realize EII is the best way for this application. Andrea, I think now you have the solution! Share this post Link to post Share on other sites
Posted 3 Mar 2008 I've been asking myself what sort of common applications need something beyond the range of the basic timer and one thing that comes to mind is a motor hour timer. Share this post Link to post Share on other sites