Why do it this way?

ScottC

Member
Join Date
Jul 2003
Location
Phoenix
Posts
29
Hi all, I have just finished re-doing the ladder in an ancient G&L Pic409. Nothing like doing changes during the debug that requires 40k uploads at 2400bps! Smashing success though. Anyhow, I came upon a couple of lines in the ladder that were originally written as follows:
--][----][----..etc....( )
1 2 x
--][----][----..etc....( )
1 2 y
These rungs had more than what I show but they were IDENTICAL and in this sequence except for the outputs. I do not understand why the original programmer (who is quite intelligent) wrote it this way. I would ask him if he was still with my company. Is there a particular reason why you would program like this as I, in my infinant confusion, would have just had the second rung activate output "y" with the actuation of the output of the previuos rung. eg:
---][-----( )
x y
If you guys can clue me in on this, I will once again consider myself "learned" and offer my eternal gratitude to this forum.
Thanks,
Scott C
 
ScottC said:
Hi all, I have just finished re-doing the ladder in an ancient G&L Pic409. Nothing like doing changes during the debug that requires 40k uploads at 2400bps! Smashing success though. Anyhow, I came upon a couple of lines in the ladder that were originally written as follows:


--][----][----..etc....( )
1 2 x
--][----][----..etc....( )
1 2 y



These rungs had more than what I show but they were IDENTICAL and in this sequence except for the outputs. I do not understand why the original programmer (who is quite intelligent) wrote it this way. I would ask him if he was still with my company. Is there a particular reason why you would program like this as I, in my infinant confusion, would have just had the second rung activate output "y" with the actuation of the output of the previuos rung. eg:

---][-----( )
x y


If you guys can clue me in on this, I will once again consider myself "learned" and offer my eternal gratitude to this forum.
Thanks,
Scott C

Scott,

My guess is he did it for the same reason as you did your solution. Personally I'd have done it like this:


--][----][----etc----+--( )
1 2 | x
|
+--( )
y



By the way, click on "quote" on this post and take a look at the html "ladder" commands at the begining and end of my ladder rung. Adding these commands will retain the formatting for the element lables.

Mike
 
Last edited:
OK it was written like this...


A B C
-| |---| |- ( )

A B D
-| |---| |- ( )


But you prefer this...

A B C
-| |---| |- ( )

C D
-| |------- ( )



I actually prefer the first example.
But it's just that, a preference.
I prefer pickles but no onions (or at least grill them).

Now if you have more than two or three rungs like this in succession, then I may re-think my answer.
 
On second thought..

If the two rungs were in different sections of the program, the origional programer's method would have made troubleshooting less troublesome. Since he or some other programmner wouldnt have to go back and find the conditions on why "y" was on or off..
 
Ken,
Hey now! There is an original concept! God knows I made enough changes over the last 2 days of debug! And those ever slow uploads!!!By the way, the tech support guys at G&L were great.

Mike, I agree with your solution and I would do it that way in RSlogix but the "gladd" S/W for the PIC 409 does not allow paralleled outputs. Nor can you "or" around an element in the middle of the rung. All the parallel branches MUST begin on the left. It is very particular (read fussy) about branching. There was one change I never could get past the "illegal branch" error so I had to add more rungs to get around it.


Thanks always,
Scott C ( C is for continously greatful)
 
Another thing is that somewhere else in the program there may be this rung

E C
-| |-----------(U)


You may or may not want D to come on independently of C???
 
Although I don't remember the exact model, I have worked with AT LEAST one PLC that didn't allow separate outputs from a single rung.

The "Y'ed" output, therefore may not have been an option.

Likewise, using identical input rungs to calculate the output is bad programming form. It would have been better to name the original output something intuitive like "PWR ON TRIPS OK" or suchlike, assuming the first two XIC or normally open contacts were "PWR ON" and "TRIPS OK." This would allow for ease of troubleshooting as well as faster code execution.

All of the above having been said, this falls back to my canned answer to those who ask:

"I'm pretty good on the hows and whats, but for whys I can only give you my best guess unless I was involved in the original decision."

Lastly, if the original program were written with a handheld programmer, perhaps it was easier to insure the proper inputs were checked by re-entering the contacts on each and every line. Anyone who ever used a hand-held programming device, as opposed to a computer, is aware that the keystroking was tedious at best, error-prone at worst, and anything that worked met all important criteria, i.e., "It works."
 
I would always go with ScottC's preferred "2 rung" solution. The parallel outputs always look more efficient but anyone who has regularly programmed in instruction list will see that this uses more instructions. This may not be an issue in the days of ControlLogix and S7 systems but it was a major consideration when working with older hardware.
 
i like the '6 instruction example' too

This is truly a 'style' thing.

HOWEVER, if the rungs you describe are 'far apart'
in the program, it gets a bit cumbersome to keep
going from one place to another, as you try to
figure things out for troubleshooting purposes.

Yes, some, if not most, PLCs do not allow dual outputs.

Perhaps what you are looking at is a translation of a
program from another PLC, ported to the G&L.

I've done conversions where the resultant code looks
a bit unusual, but it is because it was made to look
like the original program, for consistency with the
original, and a minimum of cross-training.
 
Back
Top Bottom