CompactLogix PLC master clock / timer

realolman

Member
Join Date
Mar 2009
Location
here
Posts
584
Is there a master clock or timer in a CompactLogix that could be used in ladder logic?

For example: poll the clock at some event, and add a value to it and fire some event when the clock matches the new sum.

thank you
 
There is a real time clock, you can access it down to the microsecond with a GSV instruction. Poll that periodically, and fire your event based on a comparison.
 
If you are looking to trigger an event sometime in the future a standard timer would be more precise.

The GSV system time is very useful tool. I've used it to determine day of week per osmanmom's example, headings in daily production reports, and to get a pseudo random number.

The random number generator is a fun one, get the least significant bits of the lowest time period available (what millisecond the plc is currently at) and use it to introduce randomness into your system. We did this once to randomize a shooting gallery. My understanding is slot machines use a similar mechanism to determine results.
 
If you are looking to trigger an event sometime in the future a standard timer would be more precise.


Disagree. A standard timer is NEVER more precise then the RTC.

Go ahead, make a clock based on timers and counters, and compare it to the RTC as it runs. Every timer has issues with scan times. They are fine for approximate intervals, but not for precise intervals.
 
You are correct rdrast and I was unclear.

It depends on the application including how long the OP's timespan is, how precise the event has to be, and how often you are polling the system clock. A timer is likely a simpler solution and much more clear to future troubleshooters. On a continuous running task which has to be precise over a long timespan the GSV would be the way to go.
 
I was curious so I did a bit more digging and it looks like it really depends on the type of processor regarding timers. There is another interesting post on this topic at:
http://www.plctalk.net/qanda/showthread.php?t=75909

An unconditional GSV for the current value of the clock may add 10 microseconds per scan depending on your processor.

It appears the TON uses the system time between scans to determine it's accumulated count.

If you use the GSV offset method I would run some test cases if daylight savings will create errors. It shouldn't matter but I error on the side of paranoia.
 
Timers and GSV instructions, like every other instruction, take scan time to process. If you add ANY instruction you are increasing the scan time. Some instructions add more than others. The GSV does take more time than a timer. And, some processors are faster than others.

One difference is that the accuracy of the timer is affected by that scan time. The real-time clock accuracy is not affected by scan time. It is also not necessary to run the GSV unconditionally. Call it only when you need it. The real-time clock updates regardless. With a timer, it must be scanned for it to continue to update.

OG
 
Last edited:
Once again, comprehensive inputs from people who know what they are talking about.... this site and you people are excellent

In my application the time span is short... a few seconds, and the timing is not too critical, but I have ten objects to track from the time they pass a photocell until the time they reach a reject point.

They arrive at the photocell at random times and a few measurements are performed on them as they move along on a belt. If they fail any test, they get rejected when they reach the reject point. Problem is, they don't go through the thing one at a time ... the first one is still getting measured and has not reached the reject station before the next one comes through... there are a few of them in the system at a time.

I want to keep track of the results of ten of the measurements at a time, so I have an array for that... I thought perhaps I could poll the system clock when the objects arrive at the photocell, add a delay number to that, and then fire the reject when the system clock is GEQ than the resultant sum. It seemed pretty simple.

Among other things, the LINT of the system clock gave me some fits ( which I got figured out ) , and I finally decided that it might be easier to just use an array of ten timers and start them timing using the same index I use for the array of measurement results. Any of them could enable the reject at the correct time if the object fails a test

I think it will probably work, but it's not very elegant ...big long lines of stuff in the ladder logic. I would not be proud to show it to you folks ... any advice would be appreciated.
thank you
 
Last edited:
I don't think it would be too bad, your timers could all be enabled on one rung over 10 branches.

One way to help keep things organized would be using a user defined data type as your array to keep track of the product, test results, and that product's reject timer. I would also add a 'is_rejected' flag that would get set after the first failed test to simplify the reject logic rung. You could also use this flag to bypass tests once the product is rejected.

Are you using an array that moves product information through it (i.e. shifting the product information from array element 1 to array element 2)
OR are you using a pointer into the array to indicate the first product (i.e. pointer indicates the array element that gets the next product entering the testing area and it increments each time a new product starts)? One method may make more sense for the application and for future troubleshooters than the other.

I'm curious if anyone else has any ideas.
 

Similar Topics

Hi everyone, i have a compact logic 1769-L18 PLC and I'm using FTalk View ME for the display. I wanted to do some visualization on Grafana. At...
Replies
1
Views
95
Hello. Was just curious, if it is possible to load an image from an SD card on to a Compactlogix PLC that came straight out of the box brand new...
Replies
4
Views
545
I'm working on troubleshooting a PLC for a piece of manufacturing equipment. The issue I'm trying to resolve is an open wire fault not getting...
Replies
2
Views
530
Hi all, this is my first post and appreciate your advise in advance. I have a job to migrate a system form Mitsubishi FX5U to AB...
Replies
2
Views
839
Hello Everyone, A very important question: We are having trouble receiving analog output cards (5069-OF4) for our CompactLogix PLC racks. I am...
Replies
12
Views
3,186
Back
Top Bottom