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

Recipe A                                       Location in RSLogix software
                                 3452    #N7:10
                                 6789    Length = 4                           COP  FLL  DDV  SCL  INT  STE  STS  STD  PID
                                 8321
                                                                                  Move/Logical  File / Misc  File Shift/Sequencer  Prog
                                 983
                              File-to-file copy                               Input               Ladder logic program
                                                                         L1
                             T4:0 preset value  #T4:0.PRE                                   A
                             T4:1 preset value  Length = 4                        A                  COP
                             T4:2 preset value  File of timer preset values                          COPY FILE
                                                                                                     Source        #N40:1
                             T4:3 preset value                                                       Destination   #N20:1
                                                                                                     Length            6
                              File-to-file copy
                                         Recipe B
                                  778                                            N40:1                          N20:1
                                         #N7:20
                                 986     Length = 4                             N40:2                           N20:2
                                  342                                           N40:3                           N20:3
                                                                                N40:4                           N20:4
                                  135                                           N40:5                           N20:5
                                                                                N40:6                           N20:6
                   Figure 10-14  Copying recipes and storing values for timer
                   presets.                                              Figure 10-15  File copy (COP) instruction.


                     The exceptions to the rule that file addresses must take           Location in RSLogix software
                   consecutive words in the data table are in the timer, coun-
                   ter, and control data files for the FAL instruction. In these   COP  FLL  DDV  SCL  INT  STE  STS  STD  PID
                   three data files, if you designate a file address, the FAL in-  Move/Logical  File / Misc  File Shift/Sequencer  Prog
                   struction will take every third word in that file and make a
                   file of preset, accumulated, length, or position data within   Input         Ladder logic program
                   the corresponding file type. This might be done, for exam-  L1
                   ple, so that recipes storing values for timer presets can be             A        FLL
                   moved into the timer presets, as illustrated in Figure 10-14.  A                  FILL FILE
                     The file copy (COP) instruction and the fill file (FLL)                         Source         N15:5
                   instruction are high-speed instructions that operate more                         Destination   #N20:1 6
                                                                                                     Length
                   quickly than the same operation with the FAL instruc-
                   tion. Unlike the FAL instruction, there is no control ele-                                N20:1
                   ment to monitor or manipulate. Data conversion does not                                   N20:2
                   take place, so the source and destination should be the     N15:5                         N20:3
                                                                                                             N20:4
                   same file types. An example of the file COP instruction is                                N20:5
                   shown in Figure 10-15. The operation of the program can                                   N20:6
                   be summarized as follows:
                                                                         Figure 10-16  Fill file (FLL) instruction.
                     •  Both the source and destination are file addresses.
                     •  When input A goes true, the values in file N40 are   •  Because the instruction transfers to the end of the
                                                                             file, the file will be filled with the same data value in
                       copied to file N20.                                   each word.
                     •  The instruction copies the entire file length for each
                       scan during which the instruction is true.          The FLL instruction is frequently used to zero all of
                                                                         the data in a file, as illustrated in the program of Fig-
                     An example of the fill file (FLL) instruction is shown in   ure  10-17. The operation of the program can be summa-
                   Figure 10-16. It operates in a manner similar to the FAL   rized as follows:
                   instruction that performs the word-to-file copy in the ALL   •  Momentarily pressing pushbutton PB1 copies the
                   mode. The operation of the program can be summarized      contents of file #N10:0 into file #N12:0.
                   as follows:
                                                                           •  Momentarily pressing pushbutton PB2 then clears
                     •  When input A goes true, the value in N15:5 is cop-   file #N12:0.
                       ied into N20:1 through N20:6.                       •  Note that 0 is entered for the source value.



                                                                              Data Manipulation Instructions  Chapter 10  215







          pet73842_ch10_207-233.indd   215                                                                              03/11/15   4:02 PM
   229   230   231   232   233   234   235   236   237   238   239