Essay about Plc Timer

Submitted By LiaoBoqiang
Words: 5269
Pages: 22

9. LATCHES, TIMERS, COUNTERS AND MORE

9.1 INTRODUCTION
More complex systems cannot be controlled with combinatorial logic alone. The main reason for this is that we cannot, or choose not to add sensors to detect all conditions. In these cases we can use events to estimate the condition of the system. Typical events used by a PLC include; first scan of the PLC - indicating the PLC has just been turned on time since an input turned on/off - a delay count of events - to wait until set number of events have occurred latch on or unlatch - to lock something on or turn it off
The common theme for all of these events is that they are based upon one of two questions "How many?" or "How long?". An example of an event based device is shown in . The input to the device is a push button. When the push button is pushed the input to the device turns on. If the push button is then released and the device turns off, it is a logical device. If when the push button is release the device stays on, is will be one type of event based device. To reiterate, the device is event based if it can respond to one or more things that have happened before. If the device responds only one way to the immediate set of inputs, it is logical.

An Event Driven Device 9.2 LATCHES
A latch is like a sticky switch - when pushed it will turn on, but stick in place, it must be pulled to release it and turn it off. A latch in ladder logic uses one instruction to latch, and a second instruction to unlatch, as shown in . The output with an L inside will turn the output D on when the input A becomes true. D will stay on even if A turns off. Output D will turn off if input B becomes true and the output with a U inside becomes true (Note: this will seem a little backwards at first). If an output has been latched on, it will keep its value, even if the power has been turned off.

A Ladder Logic Latch
The operation of the ladder logic in is illustrated with a timing diagram in . A timing diagram shows values of inputs and outputs over time. For example the value of input A starts low (false) and becomes high (true) for a short while, and then goes low again. Here when input A turns on both the outputs turn on. There is a slight delay between the change in inputs and the resulting changes in outputs, due to the program scan time. Here the dashed lines represent the output scan, sanity check and input scan (assuming they are very short.) The space between the dashed lines is the ladder logic scan. Consider that when A turns on initially it is not detected until the first dashed line. There is then a delay to the next dashed line while the ladder is scanned, and then the output at the next dashed line. When A eventually turns off, the normal output C turns off, but the latched output D stays on. Input B will unlatch the output D. Input B turns on twice, but the first time it is on is not long enough to be detected by an input scan, so it is ignored. The second time it is on it unlatches output D and output D turns off.
A Timing Diagram for the Ladder Logic in
The timing diagram shown in has more details than are normal in a timing diagram as shown in . The brief pulse would not normally be wanted, and would be designed out of a system either by extending the length of the pulse, or decreasing the scan time. An ideal system would run so fast that aliasing would not be possible.

A Typical Timing Diagram
A more elaborate example of latches is shown in . In this example the addresses are for an older Allen-Bradley Micrologix controller. The inputs begin with I/, followed by an input number. The outputs begin with O/, followed by an output number.

A Latch Example
A normal output should only appear once in ladder logic, but latch and unlatch instructions may appear multiple times. In a normal output O/2 is repeated twice. When the program runs it will examine the fourth line and change the value of O/2 in memory (remember the output scan does not occur…