Sie sind auf Seite 1von 3

Chapter 4 - Advanced Programming Techniques

*
IN1
C2
1)))1 /)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))[Upctr]1
*
*
*
*
IN2
C2
2)))1 /)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))[DNctr]1
*
*
*
*
IN3
C2
3)))1 /)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))[RSctr]1
*

Figure 4-12 - UP/Down Counter

4-11. Sequencers
Some machine control applications require that a particular sequence of events
occur, and with each step of the controller, a different operation be performed. The
programming element to do this type of control is called a sequencer. For example, the
timer in a washing machine is a mechanical sequencer in that it has the machine perform
different operations (fill, wash, drain, spin) in a predetermined sequence. Although a
washing machine timer is a timed sequencer, sequencers in a PLC are not necessarily
timed. An example of a non-timed sequencer is a garage door opener. It performs the
sequence ...up, stop, down, stop, up stop,... with each step in the sequence being activated
by a switch input or remote control input.
PLC sequencers are fundamentally counters with some extra features and some
minor differences. Counters will generally count to either their preset value (in the case of
up counters) or zero (for down counters) and stop when they reach their terminal count.
However, sequencers are circular counters; that is, they will roll over (much like an
automobile odometer) and continue counting. If the sequencer is of the type that counts
up from zero to the preset, on the next count pulse after reaching the preset, it will reset to
zero and begin counting up again. If the sequencer is of the type that counts down, on the
next count pulse after it reaches zero, it will load the preset value and continue counting
down. Like counters, sequencers have reset inputs that reset them either to zero (for the
types that count up) or to the preset value (for the types that count down). As with
counters, some PLC manufacturers provide sequencers with a third input (usually called
UP/DN) that controls the count direction. These are called bidirectional sequencers or
reversible sequencers. Alternately, other bidirectional sequencers have separate count
up and count down inputs.
4-18

Chapter 4 - Advanced Programming Techniques


Unlike counters, sequencers have contacts that actuate at any specified count of the
sequence. For example, if we have an up-counting sequencer SEQ1 with a preset value
of 10, and we would like to have a rung switch on when the sequencer reaches a count of
8, we would simply put a N/O contact of SEQ1=8 (or SEQ1:8) in the rung. For this contact,
when the sequencer is at a count of 8, the contact will be on. The contact will be off for all
other values of sequencer SEQ1. In our programs, we are allowed as many contacts of
a sequencer as desired of either polarity (N/O or N/C), and of any sequence value. If for
example, we would like our sequencer, SEQ1, to switch on an output OUT1 whenever the
sequencer is in count 3 or 8 of its sequence, we would simply connect N/O contacts
SEQ1:3 and SEQ1:8 in parallel to operate OUT1. This is shown in Figure 4-13. In rung
one, N/O contact IN1 advances the sequencer SEQ1 each time the contacts close. In rung
two, N/O contact IN2 resets SEQ1 when the contact closes. In rung three, output OUT1
is energized when the sequencer SEQ1 is in either state 3 or state 8.
*
IN1
Seq1
1)))1 /)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))[AVseq]1
*
*
*
*
IN2
Seq1
2)))1 /)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))[RSseq]1
*
*
*
* Seq1:3
OUT1
3)))1 /)))0)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))(OUT)1
* Seq1:8 *
/)))1 /)))*

Figure 4-13 - Sequencer and Output Rung

4-12. Timers
A timer is a special counter ladder function which allows the PLC to perform timing
operations based on a precise internal clock, generally 0.1 or 0.01 seconds per clock pulse.
Timers usually fall into two different categories depending on the PLC manufacturer. These
are retentive and non-retentive timers. A non-retentive timer is one which has one control
line, that is, the timer is either timing or it is reset. When this type of timer is stopped, it is
automatically reset. This will become more clear as discussion of timers continues. The
retentive timer has two control lines, count and reset. This type of timer may be started,
stopped then restarted without resetting. This means that it may be used as a totalizing
timer by simply controlling the count line. Independent resetting occurs by activating the
reset control line. At the beginning of this section, it was stated that a timer is a special
4-19

Chapter 4 - Advanced Programming Techniques


counter. The timing function is performed by allowing the counter to increment or
decrement at a rate controlled by the internal system clock. Timers typically increment or
decrement at 0.1 second or 0.01 second rates depending upon the PLC manufacturer.
An example of a non-retentive timer is shown in Figure 4-14. Notice that this timer
has only one control line containing normally open contact IN1. Also notice that, like the
counter, there are two values, ACTUAL and PRESET. These values are, as with the
counter, the present and final values for the timer. While the control line containing, in this
case, IN1 is false (IN1 is open) the ACTUAL value of the timer is held reset to zero. When
the control line becomes true (IN1 closes), the timer ACTUAL value is incremented each
0.1 or 0.01 second. When the ACTUAL value is equal to the PRESET value, the coil
associated with the timer (in this case TIM1) is energized and ACTUAL value incrementing
ceases. The PRESET value must be set so that the timer counter ACTUAL value will
increment from zero to the PRESET value in the desired time. For instance, suppose a
timer of 5.0 seconds is required using a 0.1 second rate timer. The PRESET value would
have to be 50 for this function since it would take 5.0 seconds for the counter to count from
zero to 50 utilizing a 0.1 second clock (50 X 0.1 second = 5.0 seconds). If a 0.01 second
clock were available, the PRESET value would have to be 500.

Figure 4-14 - Non-retentive Timer

An example of a retentive timer is shown in Figure 4-15. This type of timer looks
more like the counter discussed earlier. The two control lines operate in much the same
manner as the counter in that the lower line is the reset line. The top line, however, in the
case of the timer is the time line. As long as the reset line is true and the time line is true,
the timer will increment at the clock rate toward the PRESET value. As with the nonretentive timer, when the ACTUAL value is equal to the PRESET value, the coil associated
with the timer will be energized and timer incrementing will cease. As with the timer, the
PRESET value must be chosen so that the ACTUAL value will increment to the PRESET
value in the time desired dependent upon the clock rate.

4-20

Das könnte Ihnen auch gefallen