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

Input              Ladder logic program               Input              Ladder logic program
               L1                     FAL                            L1
                               A      FILE ARITH/LOGICAL                            A
                        A             Control         R6:1                    A             FAL
                                                                                            FILE ARITH/LOGICAL
                                      Length            6   EN                              Control        R6:6   EN
                                      Position          0                                   Length            5
                                      Mode             All  DN                              Position         0    DN
                                      Destination  #N7:50   ER                              Mode            INC   ER
                                                      528                                   Destination   N29:5
                                      Expression   #N7:20
                                                                                            Expression   #N29:0
                                  Expression       Destination
                                  #N7:20           #N7:50                                  First move
                                                                                 File # N29:0    Second move  Word N29:5
                            N7:20   528               528    N7:50
                                     621              621               Word 0                                 Word
                                     778              778                   1
                       File
                                    986               986                   2
                                     342              342                   3                            Fifth move
                            N7:25    135              135    N7:55          4                        Fourth move
                                                                                                  Third move
               Figure 10-11  File-to-file copy function using the FAL
               instruction.
                                                                     Figure 10-12  File-to-word copy function using the FAL
                                                                     instruction.
                 •  The length of the two files is set by the value en-
                    tered in the control element word R6:1.LEN.        •  If we start with position 0, the data from N7:100
                 •  In this instruction, we have also used the ALL        will be copied into N7:101 on the first false-to-true
                    mode, which means all of the data will be trans-      transition of input A.
                    ferred in the first scan in which the FAL instruction   •  The second false-to-true transition of input A will
                    sees a false-to-true transition.                      copy the data from N7:100 into N7:102.
                 •  The DN bit will also come on in that scan unless an   •  On successive false-to-true transitions of the instruc-
                    error occurs in the transfer of data, in which case the   tion, the data will be copied into the next position in
                    ER bit will be set, the instruction will stop operation   the file until the end of the file, N7:106, is reached.
                    at that position, and then the scan will continue at
                    the next instruction.
                                                                          Input            Ladder logic program
                  Figure 10-12 shows an example of a file-to-word copy   L1
               function using the FAL instruction. The operation of the        A     A     FAL
               program can be summarized as follows:                                       FILE ARITH/LOGICAL    EN
                                                                                           Control         R6:2
                 •  With each false-to-true rung transition of input                       Length            6   DN
                                                                                                             0
                    A, the processor reads one word of integer                             Position   Incremental  ER
                                                                                           Mode
                    file N29.                                                              Destination  #N7:101
                                                                                                             0
                 •  The processor starts reading at word 0, and writes                     Expression    N7:100
                    the image into word 5 of integer file N29.
                 •  The instruction writes over any data in the
                    destination.
                                                                                       First move
                  Figure 10-13 shows an example of a word-to-file copy   N7:100                                  N7:101
               function using the FAL instruction. It is similar to the file-
               to-word copy function except that the instruction copies
               data from a word address into a file. The operation of the
               program can be summarized as follows:                                                             N7:106
                 •  The expression is a word address (N7:100) and the   Figure 10-13  Word-to-file copy function using the FAL
                    destination is a file address (#N7:101).         instruction.



               214        Chapter 10  Data Manipulation Instructions







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