Programming Style Question

jthornton

Member
Join Date
Jul 2002
Location
Poplar Bluff, MO
Posts
295
I have a single event trigger that stays on for the duration of the event. I have multiple things that happen during different times of the event. My question is there any difference in using one timer and a greater than comparision with a one shot to fire each thing or have several timers started by the event and use the done bit to fire each thing. I know both work I am just wondering if one has any merits over the other??


[event]---------(timer 1)
[grt 1]--[ons]---(fire 1)
[grt 2]--[ons]---(fire 2)
...
or
[event]---------(timer 1)
|-(timer 2)
(timer 1/DN)----(fire 1)
(timer 2/DN)----(fire 2)



Thanks
John
 
I think using only one timer is better. The one timer tag can be named after the event. The logic is easier to read and keep track of that way. Using one timer uses less memory.
 
I think I have to give our favorite answer here; "It depends".

The way you've presented it, there is no advantage to using multiple timers, since all events are triggered based on the elapsed time since the initiating event. The single timer uses less memory and it might be easier to debug. However, if the events must follow each other in sequence, and you need to change the time for one of the early events in the sequence, you might find that you have to change the times for many (or all) of the events that occur later.

If you use individual timers, each triggered by the completion of the preceding event, you could get away with only having to change one timer.

Which approach is best depends on the details of your application.
 
The events all happen reletive to the begining of the timer and to each other as well. But I might need to move one event one way or another on the time line without disturbing the others so the one timer approch works best for me in this application...

Thanks for the input

John
 
How would you prefer to do it if "YOU WERE THE COMPUTER"...

That is, if you were handling the process manually, would you rather be juggling a half-dozen stop-wates or just one?

If one stop-watch gives you the info you need, then why use more than one?

I've always liked the idea of using one "train" (timer) with multiple "whistle-stops" (activity points). It's more-or-less an old-fashioned, washing machine "drum switch", doan cha know? Very reliable! And adjustable - statically or dynamically!

That is, of course, unless there are other issues related to the activity you are trying to control. In that case, just as Steve says... "It Depends".
 
Another angle to look at is when you use more timers you use 3 words per timer. When you check for the timed values you are using a few less........ besides the various valid reasons for using one timer.

:p
 
event timing

Personaly I would only us one timer because what you are tring to accomplish is based from one start time so it will be much clearer to anyone following the logic to see the opperation.The only thing I may do different is if the timer timebase is quick enough Ie 1/100 time base you may find that you can use an equal bit to trigger your funtions without having to use an osr.
Joe
 

Similar Topics

Hi all, I've been reading up on latches vs seals. I am working with SLC500's. From what I understand, the only thing to be aware of regarding...
Replies
11
Views
5,591
Dear Engineers, I think you can help me with understanding old style PLC code from ABB Prokontik. (DIN 19239) Please see attached photo from...
Replies
2
Views
1,577
Dear all, I was told by my new boss that I need to use state type programming style in the RSLogix5000. I was not have any experience with any...
Replies
20
Views
7,413
Hi I have a question about programming style. What I know is it is better to have a few sub routines grouping the functions together, like...
Replies
19
Views
6,734
Good Evening, All, Let me first apologize for this becoming something of a rant. I have a sort of a style-related question running around in my...
Replies
18
Views
9,196
Back
Top Bottom