Programmable
Download
1 / 67

Programmable Logic Controllers Third Edition - PowerPoint PPT Presentation


  • 178 Views
  • Uploaded on

Programmable Logic Controllers Third Edition. Frank D. Petruzella McGraw-Hill. Chapter 8. Programming Counters. A preset counter can control an external circuit when its counted total matches the user-entered preset limits. . Counters.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Programmable Logic Controllers Third Edition' - drew


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Programmable

Logic Controllers

Third Edition

Frank D. Petruzella

McGraw-Hill


Chapter 8

Programming

Counters


A preset counter can control an external circuit when its counted total matches the

user-entered preset limits. 

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.


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.

Mechanical Counters

Programmed counters can serve the same functions as mechanical counters.


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.

Applications

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.


The coil is assigned an address as well as being identified as a counter

Increments counter by 1 for every false-to-true transition

Like the timer, preset and accumulated values are included

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.


Same address as a counter

Resets counter when true

Coil-Formatted Counter And Reset Instruction


Count line as a counter

Type of

counter

Output

line

Preset value

Accumulated

value

Reset line

Block-Formatted Counter Instruction

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 as a counter

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 as a counter

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 as a counter

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.


7 as a counter

Simple Up-counter Program



C5 Counter Data File as a counter

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.



ControlLogix Count-Up Counter Instruction as a counter

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,438,647 and the min value is –2,147,438,648.


Decrements the accumulated as a counter

value at each false-to-true

transition and retains the

accumulated value when

power cycle occurs

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

Counts high-speed pulses

from a fixed controller

high-speed input

RES

Count-Down

Count-Up

HSC

CTD

CTU

High-Speed

Counter

Reset

RSLogic Counter Commands

Command Name Description


Parts Counting Program as a counter

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


10 as a counter

15

9

10

5

9

1

Parts Counting Program


1. as a counter 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. as a counter 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. as a counter 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. as a counter 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. as a counter 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


One-Shot, Or Transitional, Contact Program as a counter

The transitional or one shot contact program can be used to automatically clear or reset a counter. The program is designed to generate an output pulse that, when triggered, goes on for the duration of one program scan and then goes off.


One-Shot, Or Transitional, Contact Program as a counter

The transitional or one shot contact program can be used to automatically clear or reset a counter. The program is designed to generate an output pulse that, when triggered, goes on for the duration of one program scan and then goes off.

The one-shot can be triggered from a momentary signal, or one that comes on and stays on for some time.


Types Of Transitional Contacts as a counter

Off-To-On Transitional Contact

Is programmed to provide a one-shot pulse when the referenced trigger signal makes a positive (off-to-on) transition

On

Off

Symbol

On

One

scan

Off

On-To-Off Transitional Contact

On

Is programmed to

provide a one-shot pulse when the referenced trigger

signal makes a negative

(on-to-off) transition

Off

On

Symbol

One

scan

Off


Conveyor Motor Circuit That Uses A as a counter

Programmed One-Shot Reset Circuit

Proximity

switch

Sequential Task:

The start button is pressed to start the conveyor motor

Case

Count reset

button

Conveyor motor

Start/Stop station

Cases move pass the proximity switch and increment the counter's accumulated value

After a count of 50, the conveyor motor stops automatically

and the counter's accumulated value is reset to zero

The conveyor motor can be stopped or started manually at

anytime without loss of the accumulated count


50 as a counter

Conveyor Motor Circuit That Uses A

Programmed One-Shot Reset Circuit


One-Shot Rising (OSR) Instruction as a counter

  • Triggers a one-time event.

  • The OSR instruction is a retentive input instruction that triggers an event to occur only one time. Use the OSR instruction when an event must start based on change of state of the rung from false to true.

  • When the input instruction goes from false to true, the OSR instruction conditions the rung so that the output goes true for one scan. The output goes false and remains false for successive scans until the input makes another false to true transition.


Alarm Monitor Program as a counter

  • The alarm is triggered by the closing of liquid level switch LS1

  • The light will flash whenever the alarm condition is triggered and has not been acknowledged, even if the alarm condition clears in the meantime

  • The alarm is acknowledged by closing selector switch SS1

  • The light will operate in the steady mode when the alarm trigger condition exists but has been acknowledged


Alarm Monitor Program as a counter


Generic up/down counter program as a counter

Down-Counter

The down-counter output instruction will count down or decrement by 1 each time the counted event occurs. Each time the down-count event occurs, the accumulated value is decremented. Normally the down-counter is used in conjunction with the up counter to form an up/down counter.


Up/Down Counter Timing diagram as a counter

Preset Value = 3


Parking Garage Counter Program as a counter

  • As a car enters, it triggers the up-counter output instruction and

  • increments the accumulated count by 1.

  • As a car leaves, it triggers the down-counter output instruction and decrements the accumulated count by 1.

  • Since both the up- and down-counters have the same address, the accumulated value will be the same in both.

  • Whenever the accumulated value equals the preset value, the counter output is energized to light up the Lot Full sign.


50 as a counter

38

150

50

150

38

Parking Garage Counter Program


If the accumulation value is below the minimum range then the underflow (UN) bit will be true.

PLC-5 And SLC-500

Count-Down Counter Instruction


1 the underflow (UN) bit will be true.

10

1

10

When the CTU instruction

is true, C5:2/CU will be true

causing output A to be true

When the CTD instruction

is true, C5:2/CD will be true

causing output B to be true

When the accumulated value

is greater than or equal to the

preset value, C5:2/DN will be

true, causing output C to be

true

Input C going true will cause

both counter instructions to

reset

Up/Down-Counter Program


In-Process Monitoring System the underflow (UN) bit will be true.

After processing, finished parts appearing at the out-feed sensor

generate down counts, so the accumulated count of the counter

continuously indicates the number of in-process parts.

Before start-up, the system is completely empty of parts, and the counter is reset manually to zero.

When the operation begins, raw parts move through the in-feed

sensor, with each part generating an up count.


5 the underflow (UN) bit will be true.

8

8

5

In-Process Monitoring System


15000 the underflow (UN) bit will be true.

Counting Beyond The Maximum Count


If the input changes faster than one scan period, the count value will become unreliable because counts will be missed. When this is the case you need to use a high-speed counter.

Counter Speed

The maximum speed of transitions you can count is

determined by your program's scan time. Any counter

input signal must be fixed for one scan time to be counted reliably.


Cascading Counters value will become unreliable because counts will be missed. When this is the case you need to use a high-speed counter.

Depending on the application, it may be necessary to count events that exceed the maximum number allowable per counter instruction. One way of accomplishing this is by interconnection, or cascading, two counters.


The output of the first counter is programmed into the input of the second counter

The status bits of both counters are programmed

in series to produce an output

Counting Beyond The Maximum Count

These two counters allow twice as many counts to be measured


500 of the second counter

0

1

The output light turns on after 500 x 500, or 250,000 transitions of the count input

Cascading Counters For Extremely Large Counts

Whenever counter C5:1 reaches 500, its done bit resets counter C5:1 and increments counter C5:2 by 1


The timer times for a 60 s period, after which its done bit is set. This, in turn cases C5:0 to increment 1 count. On the next processor scan, the timer is reset and begins timing again.

Whenever C5:0 reaches its preset value of 60, its done bit is set. This, in turn causes it to reset itself and C5:1 to increment 1 count.

Whenever C5:1 reaches its preset value of 24, its done bit is set to reset itself.

24 Hour Clock Program


Program For is set. This, in turn cases C5:0 to increment 1 count. On the next processor scan, the timer is reset and begins timing again.

Monitoring

The Time

Of An Event


The encoder disk interrupts the light as the encoder shaft is rotated to produce the square wave output waveform.

Incremental Encoder

An incremental encoder creates a series of square waves as its shaft is rotated.


To divide a shaft revolution into 100 parts, an encoder could be selected to supply 100 square wave cycles per revolution. By using a counter to those cycles, we could tell how far the shaft has rotated.

Incremental Encoder

The number of square waves obtained from the output of the encoder can be made to correspond to the mechanical movement required.


Cutting Objects To A Specific Size could be selected to supply 100 square wave cycles per revolution. By using a counter to those cycles, we could tell how far the shaft has rotated.

The object is advanced for a specific distance and measured by encoder pulses to determine the correct length for cutting.


Count input pulses are generated by the magnetic sensor, which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

The photoelectric sensor monitors a reference point on the conveyor. When activated, it prevents the unit from counting, thus permitting the counter to accumulate counts only when bar stock is moving.

Counter Used For Length Measurement


Counter Used For Length Measurement which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

Photo sensor activated, therefore,

accumulated count remains at 10

10


Combining Counter And Timer Functions which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

Automatic Stacking Process

When the start button is pressed, conveyor M1 begins running.

After 15 plates have been stacked, conveyor M1 stops and conveyor M2 begins running.

After conveyor M2 has been operated for 5 s, it stops and the sequence is repeated automatically.

The done bit of the timer resets the timer and counter, and provides a momentary pulse to automatically restart conveyor M1.


Automatic which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

Stacking

Program


Motor Lock-Out Program which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

Designed to prevent a machine operator from starting a motor that has tripped off more than 5 times in an hour.

The normally open (OL) relay contact momentarily closes each time an overload current is sensed.

Every time the the motor stops due to an overload condition, the motor start circuit is locked out for 5 min.

If the motor trips off more than 5 times in an hour, the motor stat circuit is permanently locked out and cannot be started until the reset button is actuated.


Motor which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

Lock-Out

Program


Product Flow Rate Program which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

This program is designed to indicate how many parts per minute pass a given process point.

Parts

Sensor

When the start switch is closed, both the counter and timer are enabled.

The counter is pulsed for each part passing the sensor.

The counting begins and the timer starts timing through its

1-min time interval.

At the end of 1 min, the timer done bit causes the counter rung to go false. Sensor pulses continue but do not affect the PLC counter. The number of parts for the past minutes are represented by the accumulated value of the counter.


Product Flow Rate Program which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

60

28


0 which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths.

1

The output light turns on 10,000 x 100, or 1,000,000 seconds after the timer input contact closes.

Timer Driving A Counter For Long Time-Delay Period

10,000

Each timer T4:0 input closes for 10,000 s, its done bit resets itself and increments C5:0 by 1.


11. which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths. A _______ contact is designed to generate an output pulse that, when triggered, goes on for the duration of one program scan and then goes off.

(a) examine if open

(b) examine if closed

(c) internal relay

(d) transitional


12. which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths. The down-counter output instruction will increment by 1 each time the counted event occurs. (True/False)

13. Normally the down-counter is used in conjunction with the up counter. (True/False)

14. The individual up- and down-counters of an up/down counter program must have the same address. (True/False)


15. which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths. PLC counters can be used for:

a. straight counting in a process

b. two counters used to give the difference

between two counts

c. two counters used to give the sum of the

two counts

d. all of these


  • 16. which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths. Interconnecting or cascading two PLC counters involves:

  • programming the outputs of each in parallel

  • hardwiring the two in series

  • c. programming the output of the first counter into the input of the second counter

  • d. hardwiring the two in parallel


17. which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths. The incremental encoder creates:

a. a pure dc waveform

b. a sawtooth waveform

c. an ac sine waveform

d. a series of square waves


18. which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths. The maximum speed of transitions you can count is determined by:

a. the amount of PLC memory

b. the preset value of the counter

c. your program's scan time

d. all of these


  • 19. which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths. For the program shown, if the in-feed switch is pulsed 9 times followed immediately by 5 out-feed switch pulses, the accumulated count would be:

  • 0 (b) 14 (c) 50 (d) 4


  • 20. which detects passing teeth on a conveyor drive sprocket. If 10 teeth per foot of conveyor motion pass the sensor, the accumulated count of the counter would indicate feet in tenths. For the program shown, the light turns on ___

  • seconds after the timer input contact closes.

  • 1,000,000 (b) 50,000,000

  • (c) 500,000 (d) 100,000


ad