Page 232 - Programmable Logic Controllers, Fifth Edition
P. 232

Position
                                                                             struction execution time per scan.
                     •  Is the third entry and represents the current location   into multiple scans, thereby cutting down on the in-
                       in the data block that the processor is accessing.
                     •  It points to the word being operated on.         Incremental mode
                     •  The position starts with 0 and indexes to 1 less than   •  For this mode you enter the letter I.
                       the file length.                                    •  In the incremental mode, one element of data is
                     •  You generally enter a 0 to start at the beginning of   operated on for every false-to-true transition of the
                                                                             instruction.
                       a file. You may also enter another position at which
                       you want the FAL to start its operation.            •  The first time the instruction sees a false-to-true
                     •  When the instruction resets, however, it will reset   transition and the position is at 0, the data in the first
                                                                             element of the file are operated on. The position will
                       the position to 0.                                    remain at 0 and the UL bit will be set. The EN bit
                     •  You can manipulate the position from the program.    will follow the instruction’s condition.

                   Mode                                                    •  On the second false-to-true transition, the position
                     •  Is the fourth entry and represents the number of file   will index to 1, and data in the second word of the
                       elements operated on per program scan. There are      file will be operated on.
                       three choices: all mode, numeric mode, and incre-   •  The UL bit controls whether the instruction will
                       mental mode.                                          operate just on data in the current position, or
                                                                             whether it will index the position and then trans-
                   All Mode                                                  fer data. If the UL bit is reset, the instruction—on
                     •  For this mode you enter the letter A.                a false-to-true transition of the instruction—will
                     •  In the all mode, the instruction will transfer the   operate on the data in the current position and set
                       complete file of data in one scan.                    the UL bit. If the UL bit is set, the instruction—on
                     •  The enable (EN) bit will go true when the instruc-   a false-to-true transition of the instruction—will
                                                                             index the position by 1 and operate on the data in
                       tion goes true and will follow the rung condition.    their new position.
                     •  When all of the data have been transferred, the done
                       (DN) bit will go true. This change will occur on the   Destination
                       same scan during which the instruction goes true.   •  Is the fifth entry and is the address at which the pro-
                     •  If the instruction does not go to completion due to   cessor stores the result of the operation.
                       an error in the transfer of data (such as trying to   •  The instruction converts to the data type specified
                       store too large or too small a number for the data-   by the destination address.
                       table type), the instruction will stop at that point   •  It may be either a file address or an element address.
                       and set the error (ER) bit. The scan will continue,
                       but the instruction will not continue until the error   Expression
                       bit is reset.                                       •  Is the last entry and contains addresses, program
                     •  If the instruction goes to completion, the enable bit   constants, and operators that specify the source of
                       and the done bit will remain set until the instruction   data and the operations to be performed.
                       goes false, at which point the position, the enable   •  The expression entered determines the function of
                       bit, and the done bit will all be reset to 0.         the FAL instruction.

                   Numeric Mode                                            •  The expression may consist of file addresses, ele-
                     •  For this mode you enter a decimal number (1–1000).   ment addresses, or a constant and may contain only
                                                                             one function because the FAL instruction may per-
                     •  In the numeric mode, the file operation is distributed   form only one function.
                       over a number of program scans.
                     •  The value you enter sets the number of elements to   Figure 10-11 shows an example of a file-to-file copy
                       be transferred per scan.                          function using the FAL instruction. The operation of the
                     •  The numeric mode can decrease the time it takes   program can be summarized as follows:
                       to complete a program scan. Instead of waiting for   •  When input A goes true, data from the expression
                       the total file length to be transferred in one scan, the   file #N7:20 will be copied into the destination file
                       numeric mode breaks up the transfer of the file data   #N7:50.



                                                                              Data Manipulation Instructions  Chapter 10  213







          pet73842_ch10_207-233.indd   213                                                                              03/11/15   4:02 PM
   227   228   229   230   231   232   233   234   235   236   237