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

L1   Inputs        Ladder logic program              •  The OSR instruction ensures that the copy in-
                                                                          struction is executed only once on a false-to-true
                                 PB1    COP                               transition of the selector switch. In this way, if
                                        COPY FILE
                           PB1          Source        #N10:0              making the same recipe over a long period of time,
                                        Destination   #N12:0              the recipe needs to be copied only one time, not at
                                        Length            4               every scan.

                           PB2   PB2    FLL                          10.3  Data Compare Instructions

                                        FILL FILE                    Data transfer operations are all  output instructions,
                                        Source            0
                                        Destination   #N12:0         whereas data compare instructions are input instructions.
                                        Length            4          Data compare instructions are used to compare numerical
                                                                     values. These instructions compare the data stored in two
               Figure 10-17  Using the FLL instruction to change all the   or more words (or registers) and make decisions based on
               data in a file to zero.
                                                                     the program instructions. Numeric values in two words
                                                                     of memory can be compared for each of the basic data
                  Figure 10-18 is an example of the copy (COP) instruc-  compare instructions shown in Figure 10-19, depending
               tion used as part of a PLC drink-manufacturing program.   on the PLC.
               The operation of the program can be summarized as        Data comparison concepts have already been used with
               follows:                                              the timer and counter instructions. In both these instructions,
                 •  A three-position selector switch is used for drink
                    selection.
                 •  Each selector switch position is electrically isolated       Name                 Symbol
                    so that only one input circuit can be energized at           Equal to               (=)
                    any one time.                                                Not equal to           ( )
                 •  Each of the three selector switch inputs is wired to         Less than              (<)
                    its corresponding input module address.                      Greater than           (>)
                                                                                 Less than or equal to  ( )
                 •  Each recipe uses 5 memory words.                             Greater than or equal to  ( )
                 •  Depending on the type of drink selected, the recipe
                    is copied to the common working register #N7:50.  Figure 10-19  Basic PLC data compare instructions.



                                                                     Ladder logic program

                                                          Lime 1  B3:0/0
                                     L1  Inputs                               COP
                                                                   OSR        COPY FILE
                                                                              Source                #N12:0
                                                                              Destination        #N7:50
                                                                              Length                          5
                                            Lime 1
                                             Cola 2      Cola 2   B3:0/1
                                                                              COP
                                             Cherry 3              OSR        COPY FILE
                                                                              Source                #N12:5
                                                                              Destination        #N7:50
                                             1                                Length                          5

                                                2
                                                         Cherry 3  B3:0/2
                                             3                                COP
                                                                   OSR        COPY FILE
                                       Selector switch                        Source               #N12:10
                                                                              Destination        #N7:50
                                                                              Length                          5


                                     Figure 10-18  The copy (COP) instruction used as part of a PLC drink-
                                     manufacturing program.



               216        Chapter 10  Data Manipulation Instructions







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