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

Tag Name       Data Type  Style                       24 bottle counter
                              -Part_Counter   COUNTER  Decimal                        CTU
                                                                                      Count Up                CU
                                -Part_Counter.PRE  DINT  Decimal
                                                                                      Counter  Package_Counter
                                -Part_Counter.ACC  DINT  Decimal                      Preset           24      DN
                                Part_Counter.CU  BOOL  Decimal                        Accum             0
                                Part_Counter.CD  BOOL  Decimal
                                Part_Counter.DN  BOOL  Decimal
                                Part_Counter.OV  BOOL  Decimal                          New Tag
                                Part_Counter.UN  BOOL  Decimal
                                                                                         Name  Package_Counter
                   Figure 15-68  ControlLogix counter parameters and
                   status bits.                                                         Description  24 bottle counter

                     •  CD (Count-Down Enable Bit)—The count-down                        Tag Type  Base
                       enable bit indicates the CTD instruction is enabled.             Data Type  COUNTER
                     •  DN (Count-Up Done Bit)—The DN bit is set (1)
                       when ACC value is equal to or greater than the PRE                 Scope  Main program
                       value and is reset by the RES instruction.        Figure 15-69  Counter tag validation.
                     •  OV (Overflow Bit)—The overflow bit indicates the
                       counter exceeded the upper limit. The OV bit is set
                       when the ACC value is greater than +2,147,483,647
                       and reset when the reset instruction is executed.
                       Note that the accumulated value keeps incrementing   Count-Up (CTU) Counter
                       even after the ACC value equals the PRE value.    Count-up (CTU) counters will cause the accumulated count
                     •  UN (Underflow Bit)—Indicates that the counter    to increase by 1 every time there is a false-to-true transi-
                       exceeded the lower limit of 22,147,483,648.       tion of the counter ladder rung. An example application

                     The counter tag name is declared using the new tag   of a count-up counter program used to count packets of
                   properties dialog box shown in Figure 15-69. Tag name,   bottles is shown in Figure 15-70. The operation of the
                   description (optional), tag type, data type (base type is   program can be summarized as follows:
                   used most often), and scope are selected or typed to com-  •  Each open-to-close transition of the Bottle_Sensor
                   plete the validation.                                     proximity switch causes the counter to increment by 1.


                                  Inputs                      Ladder logic program                    Outputs
                         L1                      Bottle_Sensor                                                     L2
                                                <Local:1:I.Data.1>    24 bottle counter
                                                                CTU
                                   Bottle_Sensor                Count Up                CU         Increment_PL
                                                                Counter  Package_Counter
                                                                Preset            24 *  DN
                                                                Accum              0 *
                                                                                              Preset_Reached_PL
                                                24 bottle counter            Increment_PL
                                               Package_Counter.CU          <Local:2:O.Data.4>




                                                24 bottle counter          Preset_Reached_PL
                                 Reset_Button  Package_Counter.DN          <Local:2:O.Data.5>




                                                 Reset_Button               24 bottle counter
                                                <Local:1:I.Data.3>          Package_Counter
                                                                                RES

                         Figure 15-70  Count-up counter program used to count packets of bottles.



                                                                                       Programming Counters  Part 4     369







          pet73842_ch15_333-394.indd   369                                                                              03/11/15   7:33 PM
   383   384   385   386   387   388   389   390   391   392   393