Presentation is loading. Please wait.

Presentation is loading. Please wait.

Counter The CTU CTD instruction counts upward & Down wards over a range Each time the rung goes from false- to-true. We can make an Up-Down counter by.

Similar presentations


Presentation on theme: "Counter The CTU CTD instruction counts upward & Down wards over a range Each time the rung goes from false- to-true. We can make an Up-Down counter by."— Presentation transcript:

1 Counter The CTU CTD instruction counts upward & Down wards over a range Each time the rung goes from false- to-true. We can make an Up-Down counter by using a separate up and down counter instructions using the same address/structure

2 Counter Data File CU – count up enable CD – count down enable DN – done bit OV – overflow bit UN – underflow bit UA – update accumulated value (not used) PRE – Preset value word ACC – Accumulated value word CU – count up enable CD – count down enable DN – done bit OV – overflow bit UN – underflow bit UA – update accumulated value (not used) PRE – Preset value word ACC – Accumulated value word

3 Word values Accumulator Value – Number of false to true transitions that have occurred since the counter was last reset. Accumulator Value – Number of false to true transitions that have occurred since the counter was last reset. Preset Value – Value which the counter must count up to until the PLC sets the done bit. Preset Value – Value which the counter must count up to until the PLC sets the done bit.PLC5 Values between -32,768 and 32,767CONTROLOGIX Values between 2,147,483,647to -2,147,483,648

4 Address Structure The Counter uses the typical element addressing scheme. The Counter uses the typical element addressing scheme. Examples: Examples: C5:0.ACC C5:0.ACC C11:33/DN C11:33/DN C5:2/OV C5:2/OV C12:4/UN C12:4/UN Counter.PRECounter.PRE Counter.ACCCounter.ACC Counter.DNCounter.DN PLC 5 Contrologix

5

6 Counter Uses Count the number of items being produced or tested Count the number of items being produced or tested Maintain the level in a tank by counting the number of gallons in and drained Maintain the level in a tank by counting the number of gallons in and drained Keeping track of very long duration time periods by combining a timer and counter Keeping track of very long duration time periods by combining a timer and counter Counting frequency, encoder, tachometer (pulses) Counting frequency, encoder, tachometer (pulses)

7 Counter Examples Straight counting in a process Straight counting in a process Sum of two counts Sum of two counts Difference of two counts Difference of two counts Timed interval starts when count reaches Timed interval starts when count reaches preset value preset value Count of events after fixed interval Count of events after fixed interval Rate is determined by dividing count by Rate is determined by dividing count by time interval time interval

8 Timer The TON instruction is a non-retentive timer that accumulates time when the instruction is enabled (rung-condition-in is true). The TOF instruction is a non-retentive timer that accumulates time when the when enable goes false (rung-condition-in is false). The RTO instruction is a retentive timer that accumulates time when the instruction is enabled.

9 Timer Data File Elements EN – timer enabled TT – timer timing DN – done bit PRE – Preset value word ACC – Accumulated value word

10 Word values Accumulator Value – Number of clock cycles that have occurred since the timer was enabled. Preset Value – Value which the timer must count up to until the PLC sets the done bit. Values between 0 and 32,767

11 Time Base The timers have a time base by which they are clocked. Valid Time Bases are: 1 second 0.1 seconds

12 Address Structure The Timer uses the typical element addressing scheme. Examples:T4:0.ACCT11:33/DNT4:2/TTT12:4/EN T15:56.1/0 = T15:56.PRE/0 T16:29.2/15 = T16:29.ACC/15

13 Timer On Delay (TON) Enable – Set whenever the input rung is true Timer Timing – Set when enable is true and accumulated value is less than the preset value. Done – Set when the enable is true and the accumulated value is greater than or equal to the preset value.

14

15 Timer Off Delay (TOF) Enable – Set whenever the input rung is true Timer Timing – Set when enable goes false and accumulated value is less than the preset value. Done – Set when the enable or timer timing bit is true

16

17 Retentive Timer (RTO) Enable – Set whenever the input rung is true Timer Timing – Set when enable goes true and accumulated value is less than the preset value. Done – Set when the enable is true and the accumulated value is greater than or equal to the preset value. Does not reset accumulated value when enable is false.

18

19 Timer Uses TON Create a short pulse at the beginning of a longer input condition (.TT bit) Create a short pulse at the beginning of a longer input condition (.TT bit) Delay the start of a function for defined period of time from the start of some other function (.DN bit) Delay the start of a function for defined period of time from the start of some other function (.DN bit) TOF Used to create longer output functions derived from short input functions using (.DN bit) Used to create longer output functions derived from short input functions using (.DN bit) Generate a short pulse at he end of a long input function by using (.TT bit) Generate a short pulse at he end of a long input function by using (.TT bit)

20 Timer Uses RTO Used to accumulate time for maintenance functions or for diagnostic programs Other Uses count time,Extend push button inputs,Delay inputs, De-bounce Inputs count time, Extend push button inputs, Delay inputs, De-bounce Inputs

21 Timer Examples To Try Alternate on and off of two outputs: Two alternately flashing lights. The time for the two lights could be different.Alternate on and off of two outputs: Two alternately flashing lights. The time for the two lights could be different. Multiple On Delay: Two different events start at different time intervals after an initial starting time reference point.Multiple On Delay: Two different events start at different time intervals after an initial starting time reference point. Multiple Off Delay: Two different functions remain on for two different time intervals after a process is turned off.Multiple Off Delay: Two different functions remain on for two different time intervals after a process is turned off.

22 Timer Examples To Try Interval time within a cycle: We may require that an output come on 7.5 seconds after system start up, remain on for 4.5 seconds, and then go off and stay off. The interval would then be repeated only after the system is shut off and then turned back on.Interval time within a cycle: We may require that an output come on 7.5 seconds after system start up, remain on for 4.5 seconds, and then go off and stay off. The interval would then be repeated only after the system is shut off and then turned back on. On Delay: Output B comes on at a specific set time after output A is turned on. When A is turned off, B goes off. On Delay: Output B comes on at a specific set time after output A is turned on. When A is turned off, B goes off.

23 Timer Examples To Try Off Delay: Both A and B have been turned on at the same time. Both are in operation. When A is turned off, B remains on for a specific set time period before going off.Off Delay: Both A and B have been turned on at the same time. Both are in operation. When A is turned off, B remains on for a specific set time period before going off. Limited On Time: A and B go on at the same time. B goes off after specific set time period, but A remains on.Limited On Time: A and B go on at the same time. B goes off after specific set time period, but A remains on. Repeat Cycling: An output pulses on and quickly off at a constant preset time interval.Repeat Cycling: An output pulses on and quickly off at a constant preset time interval. One-Shot Operation: Output B goes on for a specified time after output A is turned on. Output B will run for its specified time interval even if A is turned off during the B timing interval.One-Shot Operation: Output B goes on for a specified time after output A is turned on. Output B will run for its specified time interval even if A is turned off during the B timing interval.


Download ppt "Counter The CTU CTD instruction counts upward & Down wards over a range Each time the rung goes from false- to-true. We can make an Up-Down counter by."

Similar presentations


Ads by Google