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

Ladder logic program
                                                       Output
                                                                L2
                    LIM                     PL1
                    LIMIT TEST
                    Low limit     N7:28              PL1
                                    100
                    Test          N7:29
                                    125
                    High limit    N7:27
                                     50
                  True (  50) 50      100   (  100)  True
                               False

               Figure 10-29  LIM instruction where the low limit value is
               greater than the high limit value.                    Figure 10-31  MEQ instruction can be used to monitor the
                                                                     state of limit switches.
                                                                       Source: Courtesy Jayashree Electrodevices.
                 •  Instruction is false for test values greater than 50
                    and less than 100.                               source contains the limit switch address and the compare
                 •  Instruction is true because the test value is 125.  stores their desired states. The mask can block out the
                                                                     switches you don’t want to compare (Figure 10-31).
                  The program of Figure  10-30 shows a practical ex-    Figure 10-32 shows an example of an MEQ instruc-
               ample of the ControlLogix program with the Limit Test   tion. The operation of the logic rung can be summarized
               (LIM) instruction. In this program, the LIM instruction   as follows:
               will energize the Count_Within_Range output when the
               counter is within the range of 6 to 12 counts. Note that the   •  When the data at the source address match the data
               range includes the values set as the low and high limits.  at the compare address bit-by-bit (less masked bits),
                  The masked comparison for equal (MEQ) instruction       the instruction is true.
               compares a value from a source address with data at a com-  •  The instruction goes false as soon as it detects a
               pare address and allows portions of the data to be masked.   mismatch.
               One application for the MEQ instruction is to compare   •  A mask passes data when the mask bits are set (1); a
               the correct position of up to 16 limit switches when the   mask blocks data when the mask bits are reset (0).


                                                             Compare toolbar

                                                        CMP LIM MEQ EQU NEQ LES GRT
                                                   Bit  Timer/Counter Input/Output  Compare

                                 Inputs                   Ladder logic program                    Outputs
                           L1                  Counter_Input                                              L2
                                              <Local:1:I.Data.1>
                                                               CTU                      Count_Within_Range_Output
                                  Counter_Input                Count Up  Counter_Range  CU
                                                               Counter
                                                               Preset                          20  DN
                                                               Accum                           0
                                  Counter_Reset                    Count_Within_Range_Output
                                                      LIM                 <Local:2:O.Data.1>
                                                Limit Test (CIRC)
                                                Low Limit                               6
                                                Test       Counter_Range.ACC
                                                                                               0
                                                High Limit                             12
                                                 Counter_Reset
                                                <Local:1:I.Data.2>          Counter_Range
                                                                                  RES


                           Figure 10-30  ControlLogix program with the Limit Test (LIM) instruction.



               220        Chapter 10  Data Manipulation Instructions







          pet73842_ch10_207-233.indd   220                                                                              03/11/15   4:02 PM
   234   235   236   237   238   239   240   241   242   243   244