DonNH

Confused with Ladder Logic function

9 posts in this topic

Hi,

New to the forum and pretty new to PLC programming.

I took the 3-day Sysmac training a couple months ago, but just recently set up one of the NX1P2 units that we'll eventually use for a robotics application.

Right now I've got it set up just to experiment with, so I have 3 physical switches (1 momentary, the other 2 toggle) and 4 indicator lights hooked up.

Ladder program is set up to light up different LED's when the momentary contact switch  I_SW1  is pressed, based on the position of the other 2 switches.

Here's the issue:  When both of the toggle switches are ON (see lines 4 thru 8), all of the LED's light up as expected as soon as the momentary switch I_SW1 is pressed.

However, if either or both of the toggle switches are OFF (see lines 0 thru 3), even though it seems like the logic is correct, nothing happens on the output.

Lines 0&1 were modified as shown to see if using the variable O_Light1 instead of going directly to O_L1 output would work, but it didn't make any difference.

 

See attached images for example of working and not working ladder sections as the momentary switch is pressed.

In the "working" image, both the toggle switches are on. In the "not working" image, both toggle switches are off.

PLC's input & output indicator lights match what Sysmac is showing in the monitor screen, so I'm pretty sure it's in the ladder logic and not the physical wiring.

 

Thanks for any advice.

Ladder - working.png

Ladder - not working.png

Share this post


Link to post
Share on other sites

@DonNH I suggest you google the term "Duplicate Coils".

You've committed a "Duplicate Coil" programming error.

Don't fell too bad it is probably the most common new programmer error.

Share this post


Link to post
Share on other sites

Thanks!  

I knew it had to be something simple.

Share this post


Link to post
Share on other sites

I played around with this - did a few things which I thought would work but didn't, then a few things which worked.

I think this is about the cleanest way to do it:

 

 

Ladder - final.png

Share this post


Link to post
Share on other sites

Congratulations on your first (of many) duplicate coil error! A milestone in ladder programming.
 

Share this post


Link to post
Share on other sites

No, that combination of set and reset coils doesn't follow changes to SW2 and SW3 while SW1 is on.  (Why would you use set and reset for pure combinatorial logic?  Needless complication that just confuses ordinary people.)

{ The comment I replied to here has been deleted.  :-( }

Edited by pturmel
1 person likes this

Share this post


Link to post
Share on other sites

FWIW, I think this is the simplest implementation:

 

LampLogic.png

2 people like this

Share this post


Link to post
Share on other sites

Yes that is simpler (though it doesn't include O_L4).  It's nice to see different ways of accomplishing these things.

Next I'm playing with timers, and then I also need to really wrap my head around keeping track of things happening in specific time sequences --

Ultimately I'll be loading parts from one conveyor to another (one of which is on a mobile robot), and will need to track prox sensors in sequence to see that the switches are tripped in a specific order to ensure parts are clearly moved off one conveyor and onto another.

 

Share this post


Link to post
Share on other sites
4 hours ago, DonNH said:

it doesn't include O_L4

Ah, forgot that.  Simplest for that output is just the three contacts in series directly driving the output coil.

4 hours ago, DonNH said:

different ways of accomplishing these things

I applied standard boolean transformations to simplify the logic, similar to transforming an algebra equation.  Karnaugh maps work well, too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now