810 likes | 848 Views
Programmable Logic Controllers Third Edition. Frank D. Petruzella McGraw-Hill. Chapter 12. Sequencer and Shift Register Instructions.
E N D
Programmable Logic Controllers Third Edition Frank D. Petruzella McGraw-Hill
Chapter 12 Sequencer and Shift Register Instructions
Sequencers are used for control of dishwashers, material handling mechanisms, mechanical presses, packaging machines, rotary tables, and in many other applications where accurate, repetitive, and sequential operations are required in control circuitry. Motor Contacts Dishwasher sequencer switch Sequencers Sequencers are used whenever a repeatable operating pattern is required.
The mechanical cam-operated sequencer switch uses an an electric motor to drive the cams. A series of leaf-spring-mounted contacts interacts with the cam so that, in different degrees of rotation of the cam, various contacts are closed and opened to energize and de-energize various electrical devices. Mechanical Sequencers Mechanical sequencers are often referred to as drum switches, rotary switches, stepper switches, or cam switches.
Mechanical Drum-Operated Sequencer A mechanical drum-operated sequencer switch consists of series of contacts that are operated by pegs located on a motor driven drum. The pegs can be placed at random locations around the circumference of the drum to operate contacts. When the drum is rotated, contacts that align with the pegs will close, while the contacts where there are no pegs will remain open. The presence of a peg can be thought of as logic 1, or on, while the absence of a peg can be logic 0, or off.
Dishwasher Sequencer Switch The sequencer switch found in dishwashers is used to pilot the machinery through a wash cycle.
Dishwasher Sequencer Switch The cycle is always the same, and each step occurs for a specific time.
Sequencer Instructions The PLC sequencer instruction can be used to replace electromechanical drum switches. Sequencer instructions can perform the same specific "on" or "off" patterns of outputs that are continuously repeated, but with more flexibility.
SQO SQC SQL SQC Sequencer Compare Controls sequential machine operation by transferring 16-bit through a mask to image addresses to reference data for monitoring inputs. SQL Sequencer Load Capture reference conditions by manually stepping the machine through its operating sequences. SQO Sequencer Output Controls sequential machine operation by transferring 16-bit through a mask to image addresses for controlling outputs. Sequencer Instructions Sequencer instructions simplify your ladder program by allowing you to use a single instruction or pair of instructions to perform complex operations.
The on/off operation of 16 discrete outputs can be controlled, using a sequencer instruction, with only one ladder rung. By contrast, the equivalent contact-coil ladder control arrangement would need 16 rungs in the program. Programmed Sequencer Control Sequencer instructions can make programming many applications a much easier task.
Programmed Sequencer Control To program a sequencer binary information is entered into a series of consecutive memory words. These consecutive memory words are referred to as a word file. As the sequencer advances through the steps, binary information is transferred from the word file to the output word(s). The sequencer output (SQO) instruction can be used to control output devices sequentially. The desired sequence of operation is stored in a data file, and this information is then transferred sequentially to the outputs.
Step 1 Step 2 Step 3 Step 4 Sequencer Control Of Two-Way Traffic Lights
Using A Mask Word When a sequencer operates on an entire output word, there may be outputs associated with the word that do not need to be controlled by the sequence and could be used elsewhere in the program. To prevent the sequencer from controlling these bits a mask word is used. The mask word selectively screens out data from the sequencer word file to the output word.
Using A Mask Word For each bit of output word 050 that the sequencer is to control, the corresponding bit of mask word 040 must be set to 1. All other bits of output word 050 are set to 0 and can be used independently of the sequencer.
Programmed Sequencer Control The advantage of sequencer programming over the conventional program is the large savings of memory words. Typically, the sequencer program can do in 20 words what a standard program can do in 100 words. By setting up a sequence of events, sequencers make programming simpler and any future changes easier to make. The sequencer output (SQO) instruction can be used to control output devices sequentially. The desired sequence of operation is stored in a data file, and this information is then transferred sequentially to the outputs.
Programmed Sequencer Control Sequencer instructions are usually retentive and there can be an upper limit to the number of external outputs and steps that can be operated on by a single instruction. Many sequencer instructions reset the sequencer automatically to step 1 on completion of the last sequence step. Other instructions provide an individual reset control line or a combination of both.
Each time PB1 changes from false-to-true, the sequencer will increment to the next step When the last word in the sequencer file is transferred the done bit is set and on the next transition the instruction is reset to step one. Programmed Sequencer Control
Sequencer Program A sequencer program can be event-driven or time-driven. An event-driven sequencer operates similarly to a mechanical stepper switch that increments by one step for each pulse applied to it. A time-driven sequencer operates similar to a mechanical drum switch that increments automatically after a preset time period.
Time Driven Sequencer The following slide shows the program of a time-driven sequencer used for traffic light control at a four-way intersection. In this example the control of traffic is accomplished using two Sequencer Output (SQO) instructions and a single Timer On Delay (TON) instruction. The first sequencer file (#N7:0) is set for the four states that the traffic lights will go through. Information from this file is moved by the program to output (O:2). The second sequencer file (#N7:10) contains the preset timer values (25s and 5s). The program moves information from this file to timer T4:1's Preset. The mask allows the proper data to pass and blocks the unnecessary data.
File #B3:0 Mask 001Fh Dest O:2 Control R6:0 Length 4 Position 2 File - identifies where the output pattern data is stored Mask - filter through which all data from the sequencer file must pass before being placed in the destination or output word Des - the destination or address of the output word Control - stores the length, position, and status bits for the instruction Length – number of steps Position – tracks what the current position or step is Sequencer Output (SQO) Instruction
1. Sequencers are used whenever a ___________ • operating pattern is required. • analog (b) digital • (c) repeatable (d) non- repeatable 2. Mechanical sequencers are often referred to as: (a) drum switches (b) rotary switches, (c) cam switches (d) all of these
3. For the mechanical sequencer shown, the step represented by the equivalent sequencer data table file is: (a) 1 (b) 2 (c) 3 (d) 4
4. A single sequencer instruction can be used the on/off operation of 16 discrete outputs. (True/False) 5. To program a sequencer, binary information is entered into a word file. (True/False) • 6. Which of the following instructions is used • to control output devices sequentially? • SQC • SQO • SQL • all of these
7. The _________word selectively screens out data from the sequencer word file to the output word. • control • mask • destination • position
8. For the sequencer program shown, what outputs will be "on" during step 3? a. 4 and 9 c. 1, 8, and 12 b. 1 and 12 d. 4, 5, and 9
9. For the sequencer program shown, what is the binary code that will be stored in word 050 during step 4? a. 0000000011111111 c. 0000000100011000 b. 1010101000101000 d. 0000100000000001
10. As the PLC sequencer advances through its steps, information is transferred from: a. the output module to the input module. b. the input module to the output module. c. the word file to the output word. d. the programmer to the processor.
Event Driven Sequencer The following slide shows the program of an event-driven sequencer output instruction Data are copied from file #B3:0 at the bit locations where there is 1 in the mask, to the destination O:2 on a false-to-true transition of input A. The position indexes one position and the data are then copied. Once the position reaches the last position, then on the true-to-false transition of the instruction, the position will reset to 1. Position 0 is executed under the following conditions: the position is at 0, the instruction is true, and the processor goes from the program to the run mode. Position 0 is often used as a home or starting position, with a 0 loaded into this position through the program. When the instruction sees a false-to-true transition, it indexes to position 1.
Time-Driven SQO Program For the sequencer to be incremented automatically through each step, it must have a timer incorporated into its ladder logic program. The program of the following slide shows a timer with a preset of 3 s, which is used to pulse the input for the sequencer. The enable bit of the sequencer is used to reset the timer after each increment occurs. This circuit increments automatically through the eight steps of the sequencer at 3-s intervals when input A is closed.
The SQI can make comparisons between the states of input devices, such as limit switches, and their desired states: if conditions match, the instruction is true. PLC-5 Sequencer Input (SQI) Instruction The sequencer input instruction (SQI) allows data to be compared for equality against data stored in the sequencer file. Unlike the sequencer output instruction, the SQI instruction does not automatically increment its position each time its control logic makes a false-to-true transition. The position value in the SQI control element must be changed by another instruction (such as the move instruction) to select a new input file value to compare against the value from the source address.
PLC-5 Sequencer Input (SQI) Instruction The program of the following slide can be used to explain the operation of the PLC-5 sequencer input instruction. The entries in the instruction are similar to those in the sequencer output instruction, except the destination is replaced by the source. The SQI instruction compares a file of input image data (I:3), through a mask (FFF0), to a file reference data (#N7:11) for equality. When the status of all nonmasked bits of the word at that particular step match those of the corresponding reference word, the instruction goes true; otherwise, the instruction is false. When the combination of opened and closed switches are equal to the combination of 1's and 0's on a step in the sequencer reference file, the PL1 output becomes energized.
When programming PLC-5 sequencer input and output instructions in pairs, use the same control address, length value, and position value in each instruction. Sequencer Pairs The sequencer input (SQI) and the sequencer output (SQO) instructions can be used in pairs to monitor and control, respectively, a sequential operation. The sequencer input instruction is therefore indexed by the sequencer output instruction because both control elements have the same address, R6:5.
SLC 500 Sequencer Compare (SQC) Instruction The Allen-Bradley's PLC-5 sequencer input (SQI) and the SLC 500's sequencer compare (SQC) instructions are similar, but not identical. Both compare a value from a source address (through a mask) to one of a series of a series of data words in a sequencer file, and both perform the comparison only while their control logic is true. In both the SQI and the SQC instructions, the first data word in the input file is used as a startup pattern and is not included in the compare sequence the next time the sequence recycles.
SLC 500 Sequencer Compare (SQC) Instruction The main difference between the two is the SQC instruction is considered to be an output element in an SLC 500 program, whereas, the SQI is considered to be an input element in a PLC-5 program. Unlike the SQI instruction the SQC increments its position when its control logic goes from false-to-true. Since an output element cannot be used to control another output element, an additional status bit, called the found bit (FD) has been added to the control element for an SQC. The FD bit goes true when the source input pattern matches the sequencer file word pattern that it is being compared against, and false if the words don't match. The FD bit can be examined in the control logic that increments the SQO and SQC so that they increment together. The following slide shows how the pair are programmed in a SLC 500 program.
SLC 500 Sequencer Compare (SQC) Instruction The following slide shows an example of a SLC 500 sequencer compare (SQC) instruction program. The data in the highest 4 bits of the source (I:1) are compared to the data in file B3:22. In this example, the highest 4 bits in I:1 match the status of the highest 4 bits in #B3:22, at step position 3. If the pushbutton input I:1/0 is true at this point the found (FD) bit is set which turns output PL1 "on". Whenever the combination of opened and closed switches connected to I:1/12, I:1/13, I:1/14 and I:1/15 are equal to the combination of 1's and 0's on a step in the sequencer reference file, and the input I:1/0 is true, the PL1 output will become energized. Note how the mask (F000h) allows unused bits of the sequencer instruction to be used independently. In this example, unused bit I:1/0 is used for the conditional input of the sequencer compare rung.
The sequencer load (SQL) instruction function like a word-to-file move. It can be used as a teaching tool to load data into a sequencer file, one step at a time. SLC 500 Sequencer Load (SQL) Instruction A machine may be jogged manually through its sequence of operation, with its input devices read at each step. At each step, the status of the input devices is written to the data file in the sequencer compare instruction. As a result, the file is loaded with the desired status at each step, and these data are then used for comparison with the input status at each step, and these data are then used for comparison with the input devices when the machine is run in the automatic mode.
SLC 500 Sequencer Load (SQL) Instruction The SQL instruction of the following slide can be used to explain the the operation of the sequencer load instruction. The sequencer load instruction is used to load the file and does not function during the machine's normal operation. The sequencer load instruction does not use a mask. It copies data from the source address to the file. When the instruction goes from false-to-true, the instruction indexes to the next position and copies the data. By manually jogging the machine through its cycle, the switches connected to input I:2 of the source can be read at each position and written into the file by momentarily pressing PB1. Otherwise the data would have to entered into the file manually.
The bit shift register shifts bits serially (from bit to bit) through an array in orderly fashion. Shift Registers The PLC not only uses a fixed pattern of register (word) bits, but it can easily manipulate and change individual bits. A bit shift register is a register that allows the shifting of bits through a single register, or group of registers.
Common applications include: • Tracking parts through an assembly line • Controlling machine or process operations • Inventory control • System diagnostics Shift Registers A shift register can be used to simulate the movement or track the flow of parts and information. We use the shift register whenever we need to store the status of an event that had previously happened so that we can act upon it at a later time. This is accomplished by shifting either status or values through data files.
Basic Concept Of A Shift Register A shift data or clock pulse causes each bit in the shift register to move 1 position to the right. When the register's storage capacity is exceeded shift data are lost at the end of the shift register.