Rpm calculation application example – Rockwell Automation 1761-HHP-B30 MicroLogix 1000 with Hand-Held Programmer (HHP) User Manual

Page 483

Advertising
background image

Appendix E
Application Example Programs

E–40

The following application example illustrates how to calculate the frequency
and RPM of a device (such as an encoder) connected to a high-speed counter.
The calculated values are only valid when counting up. For a detailed
explanation of:

LD, LDI, CTU and TON instructions, see chapter 8.

LES instruction, see chapter 9.

CLR, MUL, DIV, DDV, ADD, and SUB instructions, see chapter 10.

MOV instruction, see chapter 11.

RPM Calculation Operation Overview

This is done by manipulating the number of counts that have occurred in the
high-speed counter accumulator (C0.ACC) over time. To determine this you
must provide the following application specific information:

N2 – Counts per Revolution. (i.e., the number of encoder pulses per
revolution i.e., the number of pulses until reset). This value is entered in
whole counts. For example, you would enter the value 1000 into N2 for a
1000 count A/B/Z encoder.

T0.PRE– The Rate Measurement Period (i.e., the amount of time in
which to sample the accumulation of counts). This value is entered in .01
second intervals. For example, enter the value 10 into T0.PRE for a .1
second rate measurement period . For an accurate frequency and RPM
calculation to occur, the value entered must divide evenly into 100. For
example valid=20,10,5,4,2,1 and invalid=11,9,8,7,6,3.

Once you have entered these two values the following information is
provided:

N1 – Counts per last Rate Measurement Period. This value is updated
each end of Rate Measurement Period with the number of counts that
have elapsed. Use this value if your application requires high-speed
calculations such as velocity.

N4 – Frequency. This value is updated once per second with the number
of pulses that occurred in the last second. This value (frequency) is
calculated:

Frequency (Hz)

# pulses

1 second

=

N5 – RPM. This value is calculated once per second using the frequency
value N4 together with the counts per revolution value N2. For example,
if N4 contained the value 2000 (indicates 2000 Hz) and you had specified
a 1000 count encoder in N2, the RPM calculation for N5 would be 120.
This equates to 2 encoder revolutions per second. Refer to the calculation
below:

RPM

# pulses

1 second

=

x

1 revolution

# pulses

60 seconds

1 minute

x

120 RPM

2000 pulses

1 second

=

x

1 revolution

1000 pulses

60 seconds

1 minute

x

RPM Calculation Application
Example

Advertising