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

Inputs                                  Ladder logic program
                                                     Conveyor_1_Sensor
                    L1                                 <Local:1:I.Data.4>
                                                                        CTU
                                                                        Count Up                       CU
                                                                        Counter       Conveyor_1_Parts
                               Conveyor_1_Sensor
                                                                        Preset                  250    DN
                                                                        Accum                    30
                                                     Conveyor_2_Sensor
                                                       <Local:1:I.Data.5>
                                                                        CTU
                                                                        Count Up                       CU
                                                                        Counter      Conveyor_2_Parts
                                                                        Preset                  250    DN
                                                                        Accum                    70
                               Conveyor_2_Sensor
                                                                        ADD
                                                                        Add
                                                                        Source A  Conveyor_1_Parts.ACC
                                                                                                 30
                                                                        Source B  Conveyor_2_Parts.ACC
                                                                                                 70
                                                                        Dest         Conveyor_3_Parts
                                                                                                100
                               Manual_Conveyor_Reset
                                                     Conveyor_1_Parts.DN        Conveyor_1_Parts  Conveyor_2_Parts
                                                                                     RES              RES
                                                     Conveyor_2_Parts.DN
                                Conveyor 1
                                                    Manual_Conveyor_Reset
                                     Conveyor 3        <Local:1:I.Data.2>

                        Conveyor 2
                                                         Tag Name                     Value  Style  Data Type
                                                        Conveyor_1_Parts               { . . . }    COUNTER
                                                          Conveyor_1_Parts.PRE          250 Decimal  DINT
                                                          Conveyor_1_Parts.ACC           30 Decimal  DINT
                                                          Conveyor_1_Parts.CU            0 Decimal  BOOL
                                                          Conveyor_1_Parts.DN            0 Decimal  BOOL
                                                        Conveyor_2_Parts               { . . . }    COUNTER
                                                          Conveyor_2_Parts.PRE          250 Decimal  DINT
                                                          Conveyor_2_Parts.ACC           70 Decimal  DINT
                                                          Conveyor_2_Parts.CU            0 Decimal  BOOL
                                                          Conveyor_2_Parts.DN            0 Decimal  BOOL
                                                        Conveyor_1_Sensor                0 Decimal  BOOL
                                                        Conveyor_2_Sensor                0 Decimal  BOOL
                                                        Conveyor_3_Parts                100 Decimal  DINT
                                                        Manual_Conveyor_Reset            0 Decimal  BOOL

                    Figure 15-82  Program used as part of a parts tracking system.

                                                                         it is logically false. In this example Value_1 (1420) is
                                                                         greater than Value_2 (1200) so the Greater_Than_PL is
                                   CMP  LIM  MEQ  EQU  NEQ  LES  GRT     energized.
                                                                           The compare (CMP) instruction performs a comparison
                            Bit  Timer/Counter  Input/Output  Compare
                                                                         on the arithmetic operations specified by the expression.
                   Figure 15-83  Compare toolbar for the ControlLogix    The expression may contain arithmetic operators, compari-
                   controller.                                           son operators, and tags. The execution of a CMP instruction



                                                                         Math, Comparison, and Move Instructions Part 5  377







          pet73842_ch15_333-394.indd   377                                                                              03/11/15   7:34 PM
   391   392   393   394   395   396   397   398   399   400   401