Page 275 - Programmable Logic Controllers, Fifth Edition - Mobile version
P. 275
Recall that in the mask bit pattern, a 1 passes values
while a 0 blocks the data flow but the existing bit As the sequencer advances through the steps, binary
information is transferred from the sequencer file to the
value remains the same. You use a mask register or output word.
file name when you want to change the mask pattern To illustrate the purpose and function of the sequencer
under program control. An h is placed behind the file, we will examine the operation of the four-step
parameter to indicate that the mask is a hexadecimal sequence process shown in Figure 12-8. This sequencer is
number or a B is placed to indicate binary notation. to be used to control traffic in two directions. The opera-
Decimal notation is entered without any indicator. tion of the process can be summarized as follows:
Source—Is the address of the input word or file from
which the SQC and SQL instruction obtains data for • Six outputs are to be energized from one 16-point
comparison or input to its sequencer file. output module.
Destination—Is the address of the output word or file to • Each light is controlled by one bit address of output
which the SQO moves the data from its sequencer file. word O:2.
Control—Is the address that contains the parameters • The first 6 bits are programmed to execute the fol-
with control information for the instruction. The con- lowing sequence of light outputs:
trol register stores the status byte of the instruction, - Step 1: Outputs O:2/0 (red) and O:2/5 (green)
the length of the sequencer file, and the instantaneous lights will be energized.
position in the file as follows: - Step 2: Outputs O:2/0 (red) and O:2/4 (yellow)
- The enable bit (EN; bit 15) is set by a false-to-true will be energized.
rung transition and indicates that the instruction is - Step 3: Outputs O:2/2 (green) and O:2/3 (red)
enabled. It follows the rung condition. will be energized.
- The done bit (DN; bit 13) is set after the last word - Step 4: Outputs O:2/1 (yellow) and O:2/3 (red)
in the sequencer file is transferred. On the next will be energized.
false-to-true transition of the rung with the done bit • Words B3:0, B3:1, B3:2, B3:3, and B3:4 make up
set, the position pointer is reset to 1. the sequencer file.
- The error bit (ER; bit 11) is set when the proces- • Binary information (1s and 0s) that reflects the
sor detects a negative position value, or a negative desired on or off light status for each of the four
or zero length value. steps is entered into each word of the sequencer file.
Length—Is the number of steps of the sequencer file • Before starting the sequence, you need a starting
starting at position 1. Position 0 is the start-up posi- point where the sequencer is in a neutral position.
tion. The instruction resets (wraps) to position 1 at This is provided by the start position which is
each cycle completion. The actual file length will be all zeros.
1 plus the file length entered in the instruction. Due to the way in which the sequencer instruction
Position—Indicates the step that is desired to start operates, all output points must be on a single output mod-
the sequencer instruction. The position is the word ule. When a sequencer operates on an entire output word,
location or step in the sequencer file from which the there may be outputs associated with the word that do not
instruction moves data. Any value up to the file length need to be controlled by the sequencer. In our example,
may be entered, but the instruction will always reset bits 6 through 15 of output word O:2 are not used by the
to 1 on the true-to-false transition after the instruc- sequencer but could be used elsewhere in the program. To
tion has operated on the last position. Before we start prevent the sequencer from controlling these bits of the
the sequence, we need a starting point at which the output word, a mask word is used. The use of a mask word
sequencer is in a neutral position. The start position is is illustrated in Figure 12-9. The operation of the mask
all zeros, representing this neutral position; thus, all can be summarized as follows:
outputs will be off in position 0.
To program a sequencer, binary information is first • The mask word selectively screens out data from
entered into the sequencer file or register made up of the sequencer word file to the output word.
a series of consecutive memory words. The sequencer • The hex number 003Fh is entered as the mask
file is typically a bit file that contains one bit file word parameter.
representing the output action required for each step of • For each bit of output word O:2 that the sequencer
the sequence. Data are entered for each sequencer step is to control, the corresponding bit of the mask word
according to the requirements of the control application. must be set to 1.
256 Chapter 12 Sequencer and Shift Register Instructions
pet73842_ch12_252-280.indd 256 03/11/15 7:18 PM