Page 294 - Programmable Logic Controllers, Fifth Edition - Mobile version
P. 294

•  The FIFO file fills from the beginning address of the
                       FIFO file and indexes to one higher address for each                               Vertical storage area
                                                                                                                 1
                       false-to-true transition of input A.                       FIFO stack
                                                                         In                     Out    In       2       Out
                     •  A false-to-true transition of input B causes all data
                       in the FIFO file to shift one position toward the   4     3   2     1     1     3        3        3
                       starting address of the file, with the data from the   Horizontal storage area        LIFO stack
                       starting address of the file shifting to the destination   Figure 12-37  FIFO and LIFO container stacking
                       address, N7:11.                                   operations.
                     The FIFO instruction is often used for inventory con-
                   trol. One example is where different parts need to be   the LIFO instruction pair is shown in Figure 12-38 and the
                   removed from inventory to be used in production. Each   operation of this function can be summarized as follows:
                   part is assigned a unique code, which is loaded into a
                   FIFO stack, and parts are removed in the order prescribed   •  The load and unload of the LIFO stack operates
                   by the stack. This type of control ensures that the oldest   similarly to that of the FIFO stack, except that the
                   part in the inventory is used first as the first part entered is   last word in the LIFO stack is the first word that is
                   the first part removed.                                   unloaded from the stack.
                     The opposite principle—where the last data to be      •  Words can be added to the LIFO stack without dis-
                   stored  are  the  first  to  be  retrieved—is  known  as  LIFO   turbing the words already loaded on the stack.
                   (Last In, First Out). The LIFO instruction inverts the order   •  Otherwise, LIFO instructions operate the same as
                   of the data it receives by outputting the last data received   FIFO instructions.
                   first and the first data received last. A useful analogy is
                   a pile of work on your desk. As new work arrives you    Allen Bradley ControlLogix programming with FIFO
                   drop it on the top of the stack. If your stack is LIFO, you   and LIFO functions operates similarly to the SLC 500
                   pick your next job from the top of the pile. If your stack   instructions except that tags and arrays are used in the
                   is FIFO, you pick your work from the bottom of the pile.   parameter definitions. The program of Figure 12-39 is an
                   Figure 12-37 shows how the FIFO and LIFO operations   example of the use of a ControlLogix FIFO instruction
                   work for container stacking operations.               pair as part of a data stack operation. The operation of the
                     The difference between FIFO and LIFO stack operation   program can be summarized as follows.
                   is that the LIFO instruction removes data in the reverse of   •  The thumbwheel switch input is used to set the
                   the order they are loaded (last in, first out). An example of   decimal number.




                                                  BSL  BSR  SQC  SQL  SQO  FFL  FFU  LFL  LFU
                                                      File/Misc  File Shift / Sequencer  Program Control


                               LFL                                               File #N70:3  Word
                               LIFO LOAD              EN
                               Source        N70:1                                         3
                               LIFO         #N70:3    DN                                   4
                               Control       R6:61                                         5
                               Length          64     EM                                   6
                               Position         0                                          7
                                                                                           8     64 words allocated for
                               LFU                                                         9     LIFO stack at #N70:3
                               LIFO UNLOAD            EU                                   10
                               LIFO         #N70:3            N70:1 Source                 11    Destination N70:2
                               Dest          N70:2    DN
                               Control       R6:61
                               Length          64     EM     LIFO load enters              63     LIFO unload
                               Position         0            data into stack at                   removes data
                                                             next position.                       from stack in
                                                                                                  reverse order.
                                                                                Transfer of data
                              Figure 12-38  LIFO instruction pair.



                                                                     Sequencer and Shift Register Instructions  Chapter 12  275







          pet73842_ch12_252-280.indd   275                                                                              03/11/15   7:20 PM
   289   290   291   292   293   294   295   296   297   298   299