The counter measures the amount of time that elapses between changes in the
encoder count value. The concept is similar to a period measurement and the
counter supports the same Measurement Time and Divisor settings described for
period measurement mode. Refer to the Frequency/Period Measurement section for
detailed information about these settings.
The measurement value consists of the number of changes to the encoder count
value and the duration of these changes measured by the number of 100 MHz
counter timebase ticks. The encoder count value is returned as a signed number
where the sign of the number corresponds to the direction of movement.
You can calculate the encoder velocity using the following equation:
Encoder Count Velocity
(
Counts
/
s
) =
N
counts
N
ticks
×
T
base
where
■
N
counts
is the signed number of encoder count periods measured
■
N
ticks
is the number of ticks of the counter timebase that elapsed during the
measurement
■
T
base
is the counter timebase period of 10ns
For encoder velocity measurements using a quadrature encoder, when A leads B, a
positive value is returned. When B leads A, a negative value is returned. The
following figure shows an example of velocity measurement using an X4 encoding
type quadrature encoder. The Divisor count is set to 1 and the Measurement Time is
disabled.
Figure 26. Quadrature Encoder Velocity Measurement
Counter
Read
Counter
Read
10 11 12 13 14 15 16 17
Ch A
Ch B
Counter Timebase
Counter Value
1 2 1 1 2 3 1 2 3 1 2 3 4 4 42 1 2 3 1 2 3 151 2 3
Encoder Count
Current Measurement
Read Value
2 1 2 1 3 1 3 1 3 1 4 1 4 1 5 1
4 12 1
Encoder Velocity: 1 / (2 * Counter Timebase) = 50 Mcount/s
Encoder Velocity: 1 / (4 * Counter Timebase) = 25 Mcount/s
ni.com
28
NI-9361 Getting Started