Page 80

Petruzella_ProgrammableLogicControllers__5e

Tag Name Data Type Style COUNTER DINT DINT BOOL BOOL BOOL BOOL BOOL -Part_Counter -Part_Counter.PRE -Part_Counter.ACC Part_Counter.CU Part_Counter.CD Part_Counter.DN Part_Counter.OV Part_Counter.UN Decimal Decimal Decimal Decimal Decimal Decimal Decimal Decimal Figure 15-68  ControlLogix counter parameters and status bits. • CD (Count-Down Enable Bit)—The count-down enable bit indicates the CTD instruction is enabled. • DN (Count-Up Done Bit)—The DN bit is set (1) when ACC value is equal to or greater than the PRE value and is reset by the RES instruction. • 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 even after the ACC value equals the PRE value. • UN (Underflow Bit)—Indicates that the counter exceeded the lower limit of 22,147,483,648. The counter tag name is declared using the new tag properties dialog box shown in Figure 15-69. Tag name, description (optional), tag type, data type (base type is used most often), and scope are selected or typed to complete the validation. 24 bottle counter Package_Counter 24 0 CTU Count Up Counter Preset Accum New Tag Name Package_Counter Description 24 bottle counter Tag Type Base Data Type COUNTER Scope Main program Figure 15-69  Counter tag validation. CU DN Count-Up (CTU) Counter Count-up (CTU) counters will cause the accumulated count to increase by 1 every time there is a false-to-true transition of the counter ladder rung. An example application of a count-up counter program used to count packets of bottles is shown in Figure 15-70. The operation of the program can be summarized as follows: • Each open-to-close transition of the Bottle_Sensor proximity switch causes the counter to increment by 1. Inputs Ladder logic program Outputs L1 L2 24 bottle counter Bottle_Sensor <Local:1:I.Data.1> CTU Count Up Counter Preset Accum Bottle_Sensor Increment_PL CU DN Package_Counter 24* 0* Increment_PL <Local:2:O.Data.4> 24 bottle counter Package_Counter.CU 24 bottle counter Package_Counter.DN Preset_Reached_PL <Local:2:O.Data.5> Reset_Button <Local:1:I.Data.3> 24 bottle counter Package_Counter Reset_Button RES Figure 15-70  Count-up counter program used to count packets of bottles. Preset_Reached_PL Programming Counters  Part 4 369


Petruzella_ProgrammableLogicControllers__5e
To see the actual publication please follow the link above