Programming Counters Introduction to PLCs Programming Counters ELMT

  • Slides: 36
Download presentation
Programming Counters Introduction to PLCs: Programming Counters ELMT Basic Programmable Logic Controllers Chapter 0

Programming Counters Introduction to PLCs: Programming Counters ELMT Basic Programmable Logic Controllers Chapter 0 x_W Source: www Based on Ch 8 of Frank D. Petruzella 1

Programming Counters Outline • • • Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter

Programming Counters Outline • • • Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter Applications Combining Counter and Timer Functions Review Questions x x x 2 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Chapter 8 Programming Counters

Chapter 8 Programming Counters

Programming Counters Outline • • • Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter

Programming Counters Outline • • • Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter Applications Combining Counter and Timer Functions Review Questions x x x 4 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Purpose and Application of Electronic Counters • Common applications of counters include

Programming Counters 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 x 5 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Mechanical Counters • • • Programmed counters can serve the same functions

Programming Counters 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 6 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Outline • • • Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter

Programming Counters Outline • • • Counter Instructions Up-Counter Down-Counter Cascading Counters Incremental Encoder-Counter Applications Combining Counter and Timer Functions Review Questions x x x 7 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Applications of Electronic Counters • • Electronic counters can count up, count

Programming Counters 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 x 8 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Item Counting x 9 Source: www ? ? ? based on Ch

Programming Counters Item Counting x 9 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Length Counting x 10 Source: www ? ? ? based on Ch

Programming Counters Length Counting x 10 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Footage Windup Control x 11 Source: www ? ? ? based on

Programming Counters Footage Windup Control x 11 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Electronic Counters • • When the accumulated count equals the preset count,

Programming Counters 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 x 12 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Coil-Formatted Counter Instructions Increments counter by 1 for every false-totrue transition 13

Programming Counters Coil-Formatted Counter Instructions Increments counter by 1 for every false-totrue transition 13 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Programming Counters Coil-Formatted Counter and Reset Instruction Same address Resets counter when true 14

Programming Counters Coil-Formatted Counter and Reset Instruction Same address Resets counter when true 14 Source: www ? ? ? based on Ch 8 Frank D. Petruzella

Block-Formatted Counter Instruction Count line Type of counter Output line Preset value Reset line

Block-Formatted Counter Instruction Count line Type of counter Output line Preset value Reset line Accumulated value 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 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.

Counter Counting Sequence The up-counter is incremented by 1 each time the rung containing

Counter Counting Sequence The up-counter is incremented by 1 each time the rung containing the counter is energized. 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.

Counter Counting Sequence The down-counter decrements by 1 each time the rung containing the

Counter Counting Sequence The down-counter decrements by 1 each time the rung containing the counter is energized. A counter reset is always provided to cause the counter accumulated value to be reset to a predetermined value.

Simple Up-counter Program 7

Simple Up-counter Program 7

Up-counter Program Timing Diagram

Up-counter Program Timing Diagram

C 5 Counter Data File Each counter address is made of a 3 -word

C 5 Counter Data File Each counter address is made of a 3 -word element • Bit 0 -9: Internal Use • Bit which 10: UAthe - Update value. the controller sets Specifies the value, counteraccumulation must reach before This is the number times false to truebit. transitions that have occurred since • Bitofthe 11: UNof- Underflow the done bit. When accumulated value becomes equal to or greater than the counter was last reset. OV - Overflow bit. the preset value, • Bit the 12: done status bit is set. You can use this bit to control an output device. • Bit 13: DN - Done • Bit 14: CD - Count down is enabled. • Bit 15: CU - Count up is enabled.

PLC-5 And SLC 500 Count-Up Counter Instruction

PLC-5 And SLC 500 Count-Up Counter Instruction

Control. Logix Count-Up Counter Instruction The counter address in the PLC-5 and SLC 500

Control. Logix Count-Up Counter Instruction The counter address in the PLC-5 and SLC 500 is a data table address, whereas in the Control. Logix 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 Control. Logix controller the max value is 2, 147, 483, 647 and the min value is – 2, 147, 483, 648.

RSLogic Counter Commands Command CTD RES HSC CTU Name Count-Up Count-Down High-Speed Counter Reset

RSLogic Counter Commands Command CTD RES HSC CTU Name Count-Up Count-Down High-Speed Counter Reset Decrements the accumulated value at each false-to-true transition and retains the accumulated value when power cycle occurs Counts high-speed pulses Description from a fixed controller high-speed input Increments the accumulated value at each false-to-true transition and retains the accumulated value when power cycle occurs Resets the accumulated value and status bit of the counter

Parts Counting Program Counter C 5: 2 counts the total number of parts coming

Parts Counting Program Counter C 5: 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 C 5: 1 sets bit B 3/1 to initiate the box closing sequence Counter C 5: 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 9 10 15 10 59 1

Parts Counting Program 9 10 15 10 59 1

1. One common application for a counter is keeping track of the number of

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

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

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

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

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 b. a sensor c. a pressure switch d. any of these

Counters Common applications of counters include keeping track of the number of items moving

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

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

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 The coil is assigned an address as well as being identified

Coil-Formatted Counter Instruction The coil is assigned an address as well as being identified as a counter Increments counter by 1 for every falseto-true transition Like the timer, preset and accumulated values are included 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.

Coil-Formatted Counter And Reset Instruction Same address Resets counter when true

Coil-Formatted Counter And Reset Instruction Same address Resets counter when true