How a Ladder is Scanned

Sarit,


Double-coiling is when you have the same bit address used as an output on more than one rung.

This can be confusing regardless of which type of bit address you are using, but is especially troublesome with "output" bits. In most PLC's, the last usage will control the state that gets used by the REAL WORLD output (see Ron's example).

So - if you are not looking at the "controlling" rung, what you see is not necessarily what you get . . .

Good luck,

Marc
 
Phil, now I understand now what is going on in Scan 1. Since the branch with contact 1000 is evaluated before the output instruction sets it to a 1, it is false in that "snapshot". Thanks for your explanation. A couple of lines of text added to explain this may help prevent further confusion. Hope I didn't step on your toes by calling it a mistake. It isn't a mistake, just maybe a lack of clarity.
Paul C.
 
Sarit,


I suggest signing up for Phil's newsletter. He disucess alot of things in PLC Programming. Below is the one about double coil syndrome. (Hope you don't mind Phil)


---------------------------------------------

Have you heard the term "double coil" before? Are you confused by its meaning? Well perhaps you're not alone on the subject. And if you've never heard of it before... it may actually be a good thing. Let's check out the *disease* together.

The double coil syndrome occurs when we use the same output coil more than once in our ladder program. What... we can only use the same output coil once in a program? Well, yes that's true. Let's see why:

Consider this simple example. We have two toggle switches. If either of them turn on, then a motor will turn on. Simple. We just create a two line ladder diagram that looks like this:

0001 0500

--| |-----------( )---

0002 0500

--| |-----------( )---

So, if either input 0001 or 0002 physically turn on, then output 0500 will turn on and our motor will spin. OK. Let's move on to another topic then... but wait. It won't work. Huh?? That's right. It won't work they way we designed it. Why? Because of DOUBLE COIL SYNDROME.

The dreaded programming disease appears here because we have used the same output coil (0500) twice in the same program on two seperate rungs. Care to guess what the symptoms will be? (Sometimes they're hard to diagnose)

The symptom would be turning on/off toggle switch 0001 but the motor 0500 never turns on. But if we turn on/off 0002 the motor 0500 also turns on/off. This tells us the motor is good. More checking reveals that the PLC input card is working just fine. So, back to the program.

The cause of the disease is the way our PLC scans the program.

Remember that it scans from left to right, top to bottom. Watch this.

0001 0500

--|a |-----------(b )---

0002 0500

--|c |-----------(d )---

Initially:

a and c are physically off. So, b and d are also off.

Step through the scan:

1-- We turn on toggle switch 0001 so a is now on.

2-- Since a is ON, b (0500) will turn on.

3-- c is still physically off, so d (0500) is also off.

See!! The last thing we said was that 0500 would be off. So, when the PLC goes to update the outputs, it's going to leave 0500 OFF!!

How about this situation:

Initially, a and c are physically off. So, b and d are also off.

Now we turn on toggle switch 0002 so c is now on.

Step through the scan:

1-- a is off so b (0500) is off.

2-- c is on so d (0500) will turn ON.

See!! The last thing we said was that 0500 would be ON. So, when the PLC goes to update the outputs, it's going to turn 0500 ON!!

If you've followed along, you'll notice that -- regardless of whether toggle switch 0001 is on or off, motor output 0500 reacts only to the state (on/off) of toggle switch 0002 --. If 0002 is on, 0500 is on. If

0002 is off, 0500 is off. It doesn't matter what the status of toggle switch switch 0001 is. 0001 is pretty much ignored.

How do we "cure" this disease and eliminate the syndrome?? Simple.

Just use an OR ladder. After all, we want the motor to turn on if toggle switch 0001 *OR* 0002 turns on. Here's the solution:

0001 0500

--| |-----------( )---

|

0002 |

--| |----|

Now, if switch 0001 OR 0002 turn on, 0500 will turn on. Double Coil Syndrome has been cured.

Vaccinate yourself now and you'll never get the disease!!

Just for reference about the only time the same output coil can safely be used is within subroutines and transitional(jump, etc) blocks.

 
this is your processor's brain on "double-coils" ... don't do "double coils" ...

Greeting Sarit,

see if this picture helps ...

doublecoil.JPG


the BASIC idea is that the first three rungs might as well be lying out in the parking lot ... they do nothing useful in controlling the output (Lamp X) because the last rung always overwrites the status of the bit JUST BEFORE the bit status gets sent to the contacts in the output module ...

so that's the BASIC idea ... double-coils are (generally) bad ...
triple-coils are (usually) extremely bad ... and the "quadruple coil" shown above could be considered a programmer's cry for help ...

and it looks like several people beat me to the punch ... must type faster ... must type faster ... but I'm going to go ahead and post it anyway ... after all, you can't have too much explanation when it comes to the basics ...
 
Last edited:
and while we're at it ...

Greetings to all,



OkiePC brought up an interesting thought which applies to the topic now at hand ...

Since the branch with contact 1000 is evaluated before the output instruction sets it to a 1, it is false in that "snapshot".




here’s something to make the “order of execution” crystal clear ... at least with RSLogix software ...



asciirung.JPG





the easiest way to reach the ASCII mode is to just keep double-clicking the rung number until the ASCII window pops open ... the order shown in this display will be the processor’s exact “order of execution” for the instructions on the rung ... no IFs ... no ANDs ... no BUTs ...



incidentally, BST is “Branch Start” ... NXB is “Next Branch” ... BND is “Branch End” ...
 

Similar Topics

Could somebody please shed some light one the example "How a Ladder is Scanned" I don't understand why after scan 1 the contact referenced to the...
Replies
6
Views
2,612
I got my PanelView Plus 7 working with a Micrologix 1500. How would I connect my laptop to the PanelView to view the ladder logic while operating...
Replies
6
Views
117
please help me . I have to make this ladder diagram and I can’t figure it out :(
Replies
12
Views
343
Hello, I am trying to replicate a piece of logic on the PLC5 onto an SEL RTAC. I am using ladder on SEL and FBD. I am having issue on the ladder...
Replies
13
Views
229
Hi all. Is this the simplest way to debounce inputs in Ladder (there are 2 points being debounced here)? The TOF drives the tag. I'm expecting...
Replies
15
Views
495
Back
Top Bottom