Rockwell Automation 1761-HHP-B30 MicroLogix 1000 with Hand-Held Programmer (HHP) User Manual

Page 485

Advertising
background image

Appendix E
Application Example Programs

E–42

Rung 2:2
Calculates and stores the number of counts that have occurred since the
last time that it was executed as true in N7:1 (last time=last rate
measurement timer (T4:0) expiration). The LES instruction allows for 10
counts of backlash to occur (you can adjust as needed). The add
instruction is configured for a 1000 count encoder using N7:2. (Change
this register to match the number of counts generated each Z reset.)

| Rate Period Counts last rate |
| Expiration Bit measurement period |
| |
| T4:0 +SUB–––––––––––––––+ |
|––] [––––+–––––––––––––––––––––––––––––––––+SUBTRACT +––––––+–|
| DN | |Source A C5:0.ACC| | |
| | | 0| | |
| | |Source B N7:0| | |
| | | 0| | |
| | |Dest N7:1| | |
| | | 0| | |
| | +––––––––––––––––––+ | |
| | If Counts last rate Counts last rate | |
| | negative measurement period measurement period | |
| | math flag | |
| | S:0 +LES–––––––––––––––+ +ADD–––––––––––––––+ | |
| +––] [––––––+LESS THAN +––+ADD +––––––+ |
| | 3 |Source A N7:1| |Source A N7:2| | |
| | | 0| | 1000| | |
| | |Source B –10| |Source B N7:1| | |
| | | | | 0| | |
| | +––––––––––––––––––+ |Dest N7:1| | |
| | | 0| | |
| | +––––––––––––––––––+ | |
| | Last timeout value | |
| | storage register | |
| | +MOV–––––––––––––––+ | |
| |–––––––––––––––––––––––––––––––––+MOVE +––––––+ |
| | |Source C5:0.ACC| | |
| | | 0| | |
| | |Dest N7:0| | |
| | | 0| | |
| | +––––––––––––––––––+ | |
| | Determine 1 second | |
| | count. ie: # of | |
| | rate periods | |
| | +DIV–––––––––––––––+ | |
| |–––––––––––––––––––––––––––––––––+DIVIDE +––––––+ |
| | |Source A 100| | |
| | | | | |
| | |Source B T4:0.PRE| | |
| | | 10| | |
| | |Dest C5:1.PRE| | |
| | | 10| | |
| | +––––––––––––––––––+ | |
| | Frequency | |
| | determination | |
| | counter | |
| | +CTU–––––––––––––––+ | |
| |–––––––––––––––––––––––––––––––––+COUNT UP +–(CU)–+ |
| | |Counter C5:1+–(DN) | |
| | |Preset 10| | |
| | |Accum 0| | |
| | +––––––––––––––––––+ | |
| | Frequency | |
| | calculation | |
| | register | |
| | +ADD–––––––––––––––+ | |
| |–––––––––––––––––––––––––––––––––+ADD +––––––+ |
| | |Source A N7:1| | |
| | | 0| | |
| | |Source B N7:3| | |
| | | 0| | |
| | |Dest N7:3| | |
| | | 0| | |
| | +––––––––––––––––––+ | |

Advertising