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

Destination—Address to which the FFU unloads data.
                                                                        The program of Figure 12-36 is an example of how
                  Control—R data-table type. It is a three-word ele-  data are indexed in and out of a FIFO file using the FFL
                  ment that consists of the status word, the length, and   and FFU instruction pair. The operation of the program
                  the position. When it is paired with the FFL, the con-  can be summarized as follows:
                  trol addresses are the same.                         •  The FIFO load and FIFO unload instructions share
                  Length—File length in words. Specifies the maxi-        the same control element, R6:0, which may not be
                  mum number of words in the stack.                       used to control any other instructions.
                  Position—Next location from which data are           •  FIFO, #N7:12, is the address of the stack. The
                  unloaded when the instruction goes from false           same address is programmed for the FFL and FFU
                  to true.                                                instructions.

                  The status bits of the control word are the enable (EN),   •  Data enter the FIFO file from the source address,
               the done (DN), and the empty (EM) bits. The enable bit     N7:10, on a false-to-true transition of input A.
               follows the instruction’s status, the done bit is set when   •  Data are placed at the position indicated in the
               the instruction’s position equals the length, and the empty   instruction on a false-to-true transition of the
               bit is set when all the data have been unloaded from the   FFL instruction, after which the position indicates the
               FIFO file.                                                 current number of data entries in the FIFO file.





                                    Inputs                Ladder logic program
                              L1                Input A
                                                         FFL
                                                         FIFO LOAD             EN       Integer Tabl e
                                                         Source       N7:10
                                       Input A           FIFO        #N7:12   DN               Value
                                                         Control      R6:0             N7:10     23
                                                         Length         10    EM       N7:11     16
                                                         Position        8
                                                                                       N7:12     31
                                       Input B                                         N7:13     53
                                                         FFU
                                                         FIFO UNLOAD           EU      N7:14    146
                                                         FIFO        #N7:12            N7:15    9875
                                                Input B  Dest         N7:11   DN       N7:16    125
                                                         Control      R6:0             N7:17    867
                                                         Length         10    EM       N7:18     5
                                                         Position        8             N7:19     11
                                                                                       N7:20     0
                                                                                       N7:21     0
                                                                                        Radix: Decimal

                                                                     FIFO file
                                           Destination               #N7:12
                                     N7:11    16                 0     31     N7:12  Data index
                                                                  1    53
                                    Data exit from position 0 of the  2  146        toward the
                                    FIFO file on a false-to-true  3    9875          starting
                                    transition of the FFU and write  4  125         address of
                                    over current data in the     5     867          the file, one
                                    destination.                 6     5            word with
                                            Source               7     11           each false-to-true
                                     N7:10    23                 8     0            transition of the
                                                                                    FFU.
                                                                 9     0      N7:21
                                    Data enter the FIFO file on a
                                    false-to-true transition of the FFL  Position
                                    at the position indicated in the
                                    instruction.
                              Figure 12-36  How data are indexed in and out of a FIFO file.



               274        Chapter 12  Sequencer and Shift Register Instructions







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