1 Introduction to PLCs: Programming Counters ELMT Basic Programmable Logic Controllers Chapter 0x_W Source: www Based on Ch 8 of Frank D. Petruzella
2 Outline Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter Applications Combining Counter and Timer Functions Review Questions x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
Chapter 8 Programming Counters
4 Outline Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter Applications Combining Counter and Timer Functions Review Questions x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
5 Purpose and Application of Electronic Counters Common applications of counters include keeping track of the number of items moving past a given point, and determining the number of times a given action occurs. A preset counter can control an external circuit when its counted total matches the user-entered preset limits. x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
6 Mechanical Counters Programmed counters can serve the same functions as mechanical counters. Every time the actuating lever is moved over the counter adds one number, while the actuating lever returns automatically to its original position. Resetting to zero is done with a pushbutton located on the side of the unit. x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
7 Outline Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter Applications Combining Counter and Timer Functions Review Questions x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
8 Applications of Electronic Counters Electronic counters can count up, count down, or be combined to count up and down. They are dependent on external sources, such as parts traveling past a sensor or actuating a limit switch for counting. x x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
9 Item Counting x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
10 Length Counting x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
11 Footage Windup Control x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
12 Electronic Counters When the accumulated count equals the preset count, the output is energized and the counter output is closed. The counter contact can be used as many times as you wish throughout the program as an NO or NC contact. x Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella
13 Coil-Formatted Counter Instructions Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella Increments counter by 1 for every false-to- true transition The coil is assigned an address as well as being identified as a counter Like the timer, preset and accumulated values are included
14 Coil-Formatted Counter and Reset Instruction Programming Counters Source: www ??? based on Ch 8 Frank D. Petruzella Same address Resets counter when true
Block-Formatted Counter Instruction Type of counter Preset value Accumulated value Count line Reset line Output line PLC counters operate or count on the leading edge of the input signal. The counter will either increment or decrement whenever the count input transfers from an "off" state to an "on" state. The counter will not operate on the trailing edge, or on-to-off transition of the input condition.
Counter Counting Sequence PLC counters are normally retentive. Whatever count was contained in the counter at the time of a processor shutdown will be restored to the counter on power-up. The counter may be reset, however, if the reset condition is activated at the time of power restoration. PLC counters can be designed to count up to a preset value or to count down to a preset value.
The up-counter is incremented by 1 each time the rung containing the counter is energized. Counter Counting Sequence The counter will increment until the accumulated value is equal to or greater than the preset value, at which time an output will be produced.
The down-counter decrements by 1 each time the rung containing the counter is energized. Counter Counting Sequence A counter reset is always provided to cause the counter accumulated value to be reset to a predetermined value.
Simple Up-counter Program 7
Up-counter Program Timing Diagram
C5 Counter Data File Each counter address is made of a 3-word element Bit 0-9: Internal Use Bit 10: UA - Update accumulation value. Bit 11: UN - Underflow bit. Bit 12: OV - Overflow bit. Bit 13: DN - Done Bit 14: CD - Count down is enabled. Bit 15: CU - Count up is enabled. Specifies the value, which the counter must reach before the controller sets the done bit. When the accumulated value becomes equal to or greater than the preset value, the done status bit is set. You can use this bit to control an output device. This is the number of times of false to true transitions that have occurred since the counter was last reset.
PLC-5 And SLC 500 Count-Up Counter Instruction
ControlLogix Count-Up Counter Instruction The counter address in the PLC-5 and SLC 500 is a data table address, whereas in the ControlLogix it is a predefined structure of the data type. In the PLC-5 and SLC 500, the max value for the preset and accumulated values is 32,767 and the min value is –32,768; for the ControlLogix controller the max value is 2,147,483,647 and the min value is –2,147,483,648.
RSLogic Counter Commands Command Name Description CTU Count-Up Increments the accumulated value at each false-to-true transition and retains the accumulated value when power cycle occurs CTD Count-Down Decrements the accumulated value at each false-to-true transition and retains the accumulated value when power cycle occurs HSC High-Speed Counter Counts high-speed pulses from a fixed controller high-speed input RES Reset Resets the accumulated value and status bit of the counter
Parts Counting Program Counter C5:2 counts the total number of parts coming off an assembly line for final packaging Each package must contain 10 parts When 10 parts are detected, counter C5:1 sets bit B3/1 to initiate the box closing sequence Counter C5:3 counts the total number of packages filled per day A pushbutton is used to restart the total part and package count from zero daily
Parts Counting Program
1. One common application for a counter is keeping track of the number of items moving past a given point. (True/False) 2. Timers, like counters, are not dependent on external sources for counting. (True/False) 3. The down-counter increments by 1 each time the rung containing the counter is energized. (True/False)
4. Normally, when power to your PLC system is lost, when power is restored the counter accumulated value will be: a. zero b. whatever it was preset for c. maximum d. unchanged
5. The output of a PLC counter is switch from “off” to “on” any time the count input rung is "true". (True/False) 6. A PLC up-counter normally counts true-to-false transitions. (True/False) 7. In order for the PLC counter to reset, the counter reset rung must be “false”. (True/False)
8. The done bit of a counter is true whenever: a. the accumulated value is equal to the preset value b. the counter instruction is true c. the accumulated value is greater than the preset value. d. both a and c
9. The _________ value of a PLC counter is the current count based on the number of times the rung goes from false-to-true. a. preset c. accumulated b. overflow d. underflow 10. Count rung transitions can be caused by actuating: a. a limit switch c. a pressure switch b. a sensor d. any of these
Counters Common applications of counters include keeping track of the number of items moving past a given point, and determining the number of times a given action occurs.
Mechanical Counters Programmed counters can serve the same functions as mechanical counters. Every time the actuating lever is moved over the counter adds one number, while the actuating lever returns automatically to its original position. Resetting to zero is done with a pushbutton located on the side of the unit.
Electronic Counters Electronic counters can count up, count down, or be combined to count up and down. They are dependent on external sources, such as parts traveling past a sensor or actuating a limit switch for counting. Counter Applications
Coil-Formatted Counter Instruction When the accumulated count equals the preset count, the output is energized and the counter output is closed. The counter contact can be used as many times as you wish throughout the program as an NO or NC contact. The coil is assigned an address as well as being identified as a counter Like the timer, preset and accumulated values are included Increments counter by 1 for every false- to-true transition
Coil-Formatted Counter And Reset Instruction Same address Resets counter when true