PLC ONE SHOT : PLC TUTORIAL - 16

A one-shot is an interesting and invaluable programming tool. At first glance it might be difficult to figure out why such an instruction is needed. After we understand what this instruction does and how to use it, however, the necessity will become clear.


A one-shot is used to make something happen for ONLY 1 SCAN. (you do remember what a scan is, right??) Most manufacturers have one-shots that react to an off to on transition and a different type that reacts to an on to off transition. Some names for the instructions could be difu/difd (differentiate up/down), sotu/sotd (single output up/down), osr (one-shot rising) and others. They all, however, end up with the same result regardless of the name.
                                                       

One-shot Instruction
Above is the symbol for a difu (one-shot) instruction. A difd looks the same but inside the symbol it says "difd". Some of the manufacturers have it in the shape of a box but, regardless of the symbol, they all function the same way. For those manufacturers that don't include a differentiate down instruction, you can get the same effect by putting a NC (normally closed) instruction before it instead of a NO(normally open) instruction. (i.e. reverse the logic before the difu instruction)

Let's now setup an application to see how this instruction actually functions in a ladder. This instruction is most often used with some of the advanced instructions where we do some things that MUST happen only once. However, since we haven't gotten that far yet, let's set up a flip/flop circuit. In simple terms, a flip/flop turns something around each time an action happens. Here we'll use a single pushbutton switch. The first time the operator pushes it we want an output to turn on. It will remain "latched" on until the next time the operator pushes the button. When he does, the output turns off.


Flip-flop ladder diagram
Here's the ladder diagram that does just that
                                                 :
Now this looks confusing! Actually it's not if we take it one step at a time.
  • Rung 1-When NO (normally open) input 0000 becomes true DIFU 1000 becomes true.
  • Rung 2- NO 1000 is true, NO 1001 remains false, NC 1001 remains true, NC 1000 turns false. Since we have a true path, (NO 1000 & NC 1001) OUT 1001 becomes true.
  • Rung 3- NO 1001 is true therefore OUT 500 turns true.
Next Scan
  • Rung 1- NO 0000 remains true. DIFU 1000 now becomes false. This is because the DIFU instruction is only true for one scan. (i.e. the rising edge of the logic before it on the rung)
  • Rung 2- NO 1000 is false, NO 1001 remains true, NC 1001 is false, NC 1000 turns true. Since we STILL have a true path, (NO 1001 & NC 1000) OUT 1001 remains true.
  • Rung 3- NO 1001 is true therefore OUT 500 remains true.
After 100 scans, NO 0000 turns off (becomes false). The logic remains in the same state as "next scan" shown above. (difu doesn't react therefore the logic stays the same on rungs 2 and 3)On scan 101 NO 0000 turns back on. (becomes true)

  • Rung 1-When NO (normally open) input 0000 becomes true DIFU 1000 becomes true.
  • Rung 2- NO 1000 is true, NO 1001 remains true, NC 1001 becomes false, NC 1000 also becomes false. Since we no longer have a true path, OUT 1001 becomes false.
  • Rung 3- NO 1001 is false therefore OUT 500 becomes false.



In the example above, each time the operator pushes button 0000 the difu instruction turns on(becomes true) FOR ONE SCAN. Notice that it turns on(becomes true) at the rising edge of input 0000. In other words, when input 0000 intially turns on(becomes true) the difu instruction is true. When an input initially becomes true its called the leading or rising edge. When it initially turns off(becomes false) its called the trailing or falling edge.


If after viewing the animation you still find it difficult to understand, don't feel bad. You're just an idiot and should give up!!! No not really. Just try to remember how its scanned by the plc. Think it through one instruction at a time from top to bottom, then left to right. (i.e. in this order: NO 0000, difu 1000, NO 1000, NO 1001, NC 1001, NC 1000, OUT 1001, NO 1001, OUT 500) While executing each instruction is it true or false?


Rung 2(it has 5 instructions) is the confusing part for most of us. To make it easier lets break it into sections. NO 1000 and NO 1001 are in parallel. In other words they form an "or" circuit. Call this section 1. If 1000 OR 1001 is true then this mini section is true. Next we have another section in parallel. This section is NC 1001 and NC 1000. Again these 2 are in parallel. Call this section 2. If NC 1001 OR NC 1000 is true then this section is true. Finally, those 2 parallel sections(sections 1 and 2) are in series with each other. This means that if section 1 AND section 2 are BOTH true then the rung is true and output 1001 must be true.


Now its much easier to understand, isn't it? We also just learned about OR and AND logic, commonly called parallel and series logic.

Executing the program 1 instruction at a time makes this and any program easy to follow. Actually a larger program that jumps around might be difficult to follow but a pencil drawing of the registers sure does help!
 
 
 
 


Blog, Updated at: 19:32

0 comments:

Post a Comment