Upcoming SlideShare
×

# Chapter 16 timers and counters

2,551
-1

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
2,551
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
49
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Chapter 16 timers and counters

1. 1. Chapter 16 Timer and Counter Instructions
2. 2. Objectives <ul><li>Describe the function of an on-delay timer. </li></ul><ul><li>Describe the function of an off-delay timer. </li></ul><ul><li>Describe in what instances one would use a retentive timer. </li></ul><ul><li>Describe the function of an up counter. </li></ul><ul><li>Describe the function of a down counter. </li></ul><ul><li>Describe in what instances one would use an up counter versus a down counter. </li></ul><ul><li>Define preset, accumulative value, and the timer or counter address. </li></ul><ul><li>Explain how the various timers and counters are reset. </li></ul>
3. 3. T4, Timer File <ul><li>The timer file stores only timer elements. </li></ul><ul><li>An element is a word or group of words that work together as a unit. </li></ul><ul><li>A timer is made of of three pieces or words. </li></ul><ul><ul><li>Preset value </li></ul></ul><ul><ul><li>Accumulated value </li></ul></ul><ul><ul><li>Status bits </li></ul></ul><ul><li>The preset value and accumulated value are 16-bit signed integers. </li></ul><ul><li>Status bits are single bits that make up one 16-bit word. </li></ul><ul><li>These three words work together as a unit. </li></ul>
4. 4. One Timer Element Is Made of Three 16-bit Words
5. 5. Timer Addressing <ul><li>Sample timer element addressT4:2 </li></ul><ul><ul><li>T4 = timer file 4 </li></ul></ul><ul><ul><li>:2 = timer element #2 (0-255 timer elements per file) </li></ul></ul>
6. 6. Sub-element <ul><li>A sub-element is part of an element addressable as a unit. </li></ul><ul><li>The preset value and accumulated value are sub-elements of a timer. </li></ul><ul><ul><li>T4:0.PRE </li></ul></ul><ul><ul><li>T4:0.ACC </li></ul></ul>
7. 7. Timer Status Bits <ul><li>Timers have three status bits. </li></ul><ul><li>Done bit (DN) is true when the accumulated value and preset are equal. </li></ul><ul><li>Timer timing bit (TT) is true when the timer is timing. </li></ul><ul><li>Enable bit (EN) is true when the timer instruction is enabled or true. </li></ul>
8. 8. Timer Bit Addressing <ul><li>Status bit addresses for timer file 4, timer element 2 (T4:2) are listed below: </li></ul><ul><ul><li>T4:2/DN is the address for the done bit. </li></ul></ul><ul><ul><li>T4:2/EN is the address for the enable bit. </li></ul></ul><ul><ul><li>T4:2/TT is the address for the timer timing bit. </li></ul></ul>
9. 9. Timer File T4
10. 10. C5, Counter File (1 of 2) <ul><li>The counter file stores only counter elements. </li></ul><ul><li>An element is a word or group of words that work together as a unit. </li></ul><ul><li>A counter is made of three pieces or words. </li></ul><ul><ul><li>Preset value </li></ul></ul><ul><ul><li>Accumulated value </li></ul></ul><ul><ul><li>Status bits </li></ul></ul>
11. 11. C5, Counter File (2 of 2) <ul><li>The preset value and accumulated value are 16-bit signed integers. </li></ul><ul><li>Status bits are single bits that make up one 16-bit word. </li></ul><ul><li>These three words work together as a unit. </li></ul>
12. 12. One Counter Element Is Made of Three 16-bit Words
13. 13. Counter Addressing <ul><li>Sample counter element address C5:2 </li></ul><ul><ul><li>C5 = timer file 5 </li></ul></ul><ul><ul><li>:2 = counter element #2 (0-255 timer elements per file) </li></ul></ul>
14. 14. Sub-element <ul><li>A sub-element is part of an element addressable as a unit. </li></ul><ul><li>The preset value and accumulated value are sub-elements of a counter. </li></ul><ul><ul><li>C5:0.PRE </li></ul></ul><ul><ul><li>C5:0.ACC </li></ul></ul>
15. 15. Counter Status Bits (1 of 2) <ul><li>Counters have five status bits. </li></ul><ul><li>Done bit (DN) is true when the accumulated value and preset are equal. </li></ul><ul><li>Count up enable bit (CU) is true when the up counter is true or enabled. </li></ul><ul><li>Count down enable bit (CD) is true when the count down counter is enabled or true. </li></ul>
16. 16. Counter Status Bits (2 of 2) <ul><li>The overflow bit (OV) is true when the up counter has overflowed above +32767. </li></ul><ul><li>The underflow bit (UN) is true when the down counter has underflowed below -32768. </li></ul><ul><li>The update accumulator bit (UA) is a high-speed counter status bit for fixed SLC 500 PLCs. </li></ul>
17. 17. Counter Status Bit Addressing <ul><li>Status bit addresses for counter file 5, counter element 0 (C5:0) are listed below: </li></ul><ul><ul><li>C5:0/DN is the address for the done bit. </li></ul></ul><ul><ul><li>C5:0/CU is the address for the count up enable bit. </li></ul></ul><ul><ul><li>C5:0/CD is the address for the count down enable bit. </li></ul></ul><ul><ul><li>C5:0/OV is the address for the count up overflow bit. </li></ul></ul><ul><ul><li>C5:0/UN is the address for the count down underflow bit. </li></ul></ul>
18. 18. Counter File C5
19. 19. SLC 500 On-delay Timer
20. 20. SLC 500 Timer Instructions
21. 21. SLC 500 On-delay Timer and Associated Status Bits
22. 22. SLC 500 Off-delay Timer
23. 23. SLC 500 Retentive Timer
24. 24. Retentive Timer and Its Reset Instruction
25. 25. SLC 500 Counters
26. 26. SLC 500 Count Up Counter
27. 27. SLC 500 Count Down Counter
28. 28. SLC 500 Count Down Counter Instruction
29. 29. Reset Instruction to Reset Counter C20:7
30. 30. Using the Clear Instruction to Clear C5:0.ACC and C5:1.ACC
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.