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

Page 488

Advertising
background image

Appendix E
Application Example Programs

E–45

File 2, Rung 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.)

FUN GRAPHIC PARAMETER
CODE SYMBOL MNEMONIC NAME ADDRESS VALUE FORCES
–––– ––––––– –––––––– –––– ––––––– ––––– ––––––
20 |–] [– LD
Rate Period Expiration Bit
T0/DN 0

10 MPS

81 SUB SRCA C0.ACC 0000H
last timeout value storage register
SRCB N0 0000H

11 MRD

Counts last rate measurement period
DEST N1 0000H

22 –] [– AND
If Negative Math Flag
S0/3 0

57 –LES– AND–LES
Counts last rate measurement period
SRCA N1 0000H
SRCB –10

80 ADD SRCA N2 1000

Counts last rate measurement period
SRCB N1 0000H

Counts last rate measurement period
DEST N1 0000H

11 MRD

106 MOV SRC C0.ACC 0000H
last timeout value storage register
DEST N0 0000H

11 MRD

83 DIV SRCA 100
SRCB T0.PRE 10
Determine 1 second count. ie.# of rate periods
DEST C1.PRE 10

11 MRD

5 CTU
Frequency determination counter
CNTR C1
PRE 10
ACC 0000H

11 MRD

80 ADD
Counts last rate measurement period
SRCA N1 0000H
Frequency calculation register
SRCB N3 0000H
Frequency calculation register
DEST N3 0000H

12 MPP

22 –] [– AND
1 second has now elapsed
C1/DN 0

Advertising