Searching \ for '[OT] Ladder logic programming question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devprogs.htm?key=programming
Search entire site for: 'Ladder logic programming question'.

Exact match. Not showing close matches.
PICList Thread
'[OT] Ladder logic programming question'
2006\03\04@163246 by William Couture

face picon face
A question for anyone who knows ladder logic / PLC programming:

On or "or" branch (i.e.)
---+--| |--+---
  |       |
  +--| |--+

(I hope that shows up all right.  Damned proportional fonts...)

If the "top" condition is TRUE, is the OR branch executed or not?

Thanks,
  Bill

--
Psst...  Hey, you... Buddy...  Want a kitten?  straycatblues.petfinder.org

2006\03\04@164508 by Spehro Pefhany

picon face
At 04:32 PM 3/4/2006 -0500, you wrote:
>A question for anyone who knows ladder logic / PLC programming:
>
>On or "or" branch (i.e.)
>---+--| |--+---
>    |       |
>    +--| |--+
>
>(I hope that shows up all right.  Damned proportional fonts...)
>
>If the "top" condition is TRUE, is the OR branch executed or not?
>
>Thanks,
>    Bill


You can think of this as two normally-open contacts in parallel. If either
is true (closed) then the 'power' flows from left to right, so the input
to whatever is on the right is true. The 'contacts' with the diagonal line
through them are inverted logic ('normally closed' contacts).

>Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
spam_OUTspeffTakeThisOuTspaminterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff


2006\03\04@180231 by William Couture

face picon face
On 3/4/06, Spehro Pefhany <.....speffKILLspamspam@spam@interlog.com> wrote:
{Quote hidden}

Yes, I'm aware of the EE basis of ladder logic.

However, as executed in a PLC, if one "path" is true,
is the other even evaluated?

Thanks,
  Bill

--
Psst...  Hey, you... Buddy...  Want a kitten?  straycatblues.petfinder.org

2006\03\04@184547 by Spehro Pefhany

picon face
At 06:02 PM 3/4/2006 -0500, you wrote:
{Quote hidden}

Perhaps undefined, almost certainly specific to the implementation. As one
data point, in the one I developed it would be evaluated, and the results
or'd. This is in the spirit of the "everything gets evaluated every loop"
philosophy of early PLCs. But later ones are not so consistent AFAIUI.

Why do you ask? There should not be any side effects either way.

BTW, there is one major deviation from 'real' ladder logic, and that's the
use of 'sneak' backwards paths. Is that what you've run into?

>Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
.....speffKILLspamspam.....interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff


2006\03\04@193542 by Robert Ammerman

picon face
> Yes, I'm aware of the EE basis of ladder logic.
>
> However, as executed in a PLC, if one "path" is true,
> is the other even evaluated?

I would guess this would depend on the design of the PLC.

I developed a ladder logic implementation that optimized the logic by
avoiding executing the other branches on an "or". I am not sure what other
implementations do.

As an aside, it might be amusing for me to take a couple of minutes to
describe my implementation:

1: The ladder logic diagram is drawn using special "components" as a
schematic in Eagle.

2: A netlist is exported from Eagle as a text file.

3: A compiler, which I have written, reads the text file and creates a
P-code stream that defines the operations that must be carried out to
evaluate the ladder logic. This P-code stream has been optimized in two
simple ways:

a) when evaluating a series chain of contacts ("and") it jumps to the false
case as soon as any of the contacts is not in the right state.
b) when evaluating a "or" condition I skip to the true case as soon as a
true condition is found.

4: The P-code stream is sent to the device that runs the code (which happens
to a 32-bit X86 based system running a simple kernel I wrote).

5: When received, the P-code is compiled/converted to native X86
instructions, that directly point to the data structures containing the
contact and coil states.

As you can imagine, this thing just screams. It only takes a few X86
instructions for each condition checked.

Bob Ammerman
RAm Systems

2006\03\04@223315 by William Couture

face picon face
On 3/4/06, Robert Ammerman <EraseMErammermanspam_OUTspamTakeThisOuTverizon.net> wrote:
> > Yes, I'm aware of the EE basis of ladder logic.
> >
> > However, as executed in a PLC, if one "path" is true,
> > is the other even evaluated?
>
> I would guess this would depend on the dee design of the PLC.
>
> I developed a ladder logic implementation that optimized the logic by
> avoiding executing the other branches on an "or". I am not sure what other
> implementations do.

The new controller board by the company I work for is
being targeted, for at least some simple stuff, as a low-end
PLC.

They are going to be doing a trade show at the end of
March where they want to show the hardware running as
a PLC.  Of course, what they want to show s*cks.  BAD.

So, I'm writing a graphic ladder code generator / compiler
and the processor kernel that will run it.  Fortunately, I've
written most of the pieces before, I just have to string them
together.However, in looking at code generation, I found myself
wondering if I needed to parse the extra "rungs" of an
OR if a previous rung had already evaluated true.  It would
be easier, in my design, to stop the execution tree if I
already had a "TRUE".  Based on feedback, that's what
I'm going to do.

I'll see if work will let me share the code.  Even if I can't
distribute source, you might enjoy seeing what I've done and
could give me some constructive feedback.

Later,
  Bill

--
Psst...  Hey, you... Buddy...  Want a kitten?  straycatblues.petfinder.org

2006\03\04@225423 by David VanHorn

picon face
I was thinking about this earlier, and I can't see any reason to process
beyond the first thing that decides wether the outcome is true or false.

If it's X + Y + Z, and X is false, then you're done.
If X is true, then you need to dig further.
Same in the or case, once you find a true, you're done.
But if the first is false, you have to keep digging till you run out of
inputs again.

I write my cooperative multitaskers that way.

2006\03\05@002544 by andrew kelley

picon face
On 3/4/06, David VanHorn <dvanhornspamspam_OUTmicrobrix.com> wrote:
> I was thinking about this earlier, and I can't see any reason to process
> beyond the first thing that decides wether the outcome is true or false.
>
> If it's X + Y + Z, and X is false, then you're done.

You do mean if its  X and Y and Z, and X is false..  THEN you are
done, but if X is true, you need to evaluate more..

X + Y + Z means X or Y or Z.  In which case, when X is true, no need
to evaluate further.

X + Y means X or Y
XY means X (dot) Y means X and Y

(at least in my digital logic class, book, and everywhere else[which
my professor has been teaching for over 50 years.. yep, my dad had him
too])

--
andrew

2006\03\05@091647 by David VanHorn

picon face
On 3/5/06, andrew kelley <@spam@leetslackerKILLspamspamgmail.com> wrote:
>
> On 3/4/06, David VanHorn <KILLspamdvanhornKILLspamspammicrobrix.com> wrote:
> > I was thinking about this earlier, and I can't see any reason to process
> > beyond the first thing that decides wether the outcome is true or false.
> >
> > If it's X + Y + Z, and X is false, then you're done.
>
> You do mean if its  X and Y and Z, and X is false..  THEN you are
> done, but if X is true, you need to evaluate more..


Sorry, yes.

2006\03\05@185417 by D. Daniel McGlothin

flavicon
face
> > However, as executed in a PLC, if one "path" is true,
> > is the other even evaluated?
>
> I would guess this would depend on the design of the PLC.

Execution path is defined by the PLC's documentation.  Some PLCs even
"solve" within a "rung" in a top-to-bottom, right-to-left order, instead of
the more common left-to-right, top-to-bottom.

With simple "contact" evaluation, evaluation can be reasonably
short-circuited, but many PLCs now include function blocks that are not
boolean evaluations of a single bit.  When rungs have these function blocks,
the PLC engine must provide a consistent, documented, evaluation of every
element in the rung.

Daniel

2006\03\06@090237 by Darrell Wyatt

picon face
Yes.  It helps to think of the logic as relay contacts, since that is what
it is based on.
D.


{Quote hidden}

>

2006\03\06@095711 by alan smith

picon face
Interesting.  Any peek into what the hardware looks like for this?  You might also write the code so that a normal coder can develop the control program.  Most of the software packages I have seen and used allows you to switch between ladder, logic and.....hmmm...escapes me what the third one is....but bottom line is you can develop in a non-ladder enviroment, and move back and forth.
 
 The PLC I have been using lately is from AutomationDirect and is rebranded from Koyo.  For $99 you get a nice little PLC.  The software is cheap too...think it was $49 or so (this was a few years ago when I bought it).  The biggest issue I have is the operator interface...ie....how to make changes to the timers and show the status of them.  Currently, and I think its going away, its a $250 solution but I get a NEMA4 rated panel with a keypad and a few programmable buttons.  The information for the display is loaded to the display unit, and the PLC simply sends address or data over a serial link.
 
 I've had a PIC based design done for a while, just working out the bugs as I have time as my clients needs have been rather sporadic in requirements (1 this month, 4 next month, none for 3 months....6 the next month, you get the picture) but it had a nice 2x16 LCD display, 6 relays and 6 opto isolated AC inputs.  I had it to the point of testing for noise and packaging.  Cost was around $150 for it, so it beat the price on the PLC package, but didnt have the robust nature (or at least had not proved it did or not yet).

William Couture <RemoveMEbcouturespamTakeThisOuTgmail.com> wrote:
 On 3/4/06, Robert Ammerman wrote:
{Quote hidden}

The new controller board by the company I work for is
being targeted, for at least some simple stuff, as a low-end
PLC.

They are going to be doing a trade show at the end of
March where they want to show the hardware running as
a PLC. Of course, what they want to show s*cks. BAD.

So, I'm writing a graphic ladder code generator / compiler
and the processor kernel that will run it. Fortunately, I've
written most of the pieces before, I just have to string them
together.However, in looking at code generation, I found myself
wondering if I needed to parse the extra "rungs" of an
OR if a previous rung had already evaluated true. It would
be easier, in my design, to stop the execution tree if I
already had a "TRUE". Based on feedback, that's what
I'm going to do.

I'll see if work will let me share the code. Even if I can't
distribute source, you might enjoy seeing what I've done and
could give me some constructive feedback.

Later,
Bill

--
Psst... Hey, you... Buddy... Want a kitten? straycatblues.petfinder.org

2006\03\07@114327 by Aaron

picon face
Alan,

On 3/6/06, alan smith <micro_eng2EraseMEspam.....yahoo.com> wrote:
>
> The PLC I have been using lately is from AutomationDirect and is rebranded
> from Koyo.  For $99 you get a nice little PLC.  The software is cheap
> too...think it was $49 or so (this was a few years ago when I bought
> it).  The biggest issue I have is the operator interface...ie....how to make
> changes to the timers and show the status of them.  Currently, and I think
> its going away, its a $250 solution but I get a NEMA4 rated panel with a
> keypad and a few programmable buttons.  The information for the display is
> loaded to the display unit, and the PLC simply sends address or data over a
> serial link.



For the money, they are decent PLCs.  I just despise the octal addressing,
though!

You have seen the new(er) DL06 ($199) for which you can get the optional
snap-in LCD display and keypad for $69?

Aaron

2006\03\09@123145 by alan smith

picon face
only problem with the snapin LCD is no keypad to enter new values

Aaron <EraseMEaaron.piclistspamgmail.com> wrote:  Alan,

On 3/6/06, alan smith wrote:
{Quote hidden}

For the money, they are decent PLCs. I just despise the octal addressing,
though!

You have seen the new(er) DL06 ($199) for which you can get the optional
snap-in LCD display and keypad for $69?

Aaron

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...