![background image](http://html1.mh-extra.com/html/national-instruments/usb-6210/usb-6210_user-manual_3656406113.webp)
Chapter 8
Counters
8-16
ni.com
Measurements Using Quadrature Encoders
The co
u
nters can perform meas
u
rements of q
u
adrat
u
re encoders that
u
se X1, X2, or X4 encoding. A q
u
adrat
u
re encoder can have
u
p to three
channels—channels A, B, and Z.
•
X1 Encoding
—When channel A leads channel B in a q
u
adrat
u
re
cycle, the co
u
nter increments. When channel B leads channel A in a
q
u
adrat
u
re cycle, the co
u
nter decrements. The amo
u
nt of increments
and decrements per cycle depends on the type of encoding—X1, X2,
or X4.
Fig
u
re 8-14 shows a q
u
adrat
u
re cycle and the res
u
lting increments and
decrements for X1 encoding. When channel A leads channel B, the
increment occ
u
rs on the rising edge of channel A. When channel B
leads channel A, the decrement occ
u
rs on the falling edge of
channel A.
Figure 8-14.
X1 Encoding
•
X2 Encoding
—The same behavior for X1 encoding holds for X2
encoding except the co
u
nter increments or decrements on each edge of
channel A, depending on which channel leads the other. Each cycle
res
u
lts in two increments or decrements, as shown in Fig
u
re 8-15.
Figure 8-15.
X2 Encoding
Ch A
Ch B
Co
u
nter V
a
l
u
e
7
7
6
5
5
6
Ch A
Ch B
Counter Value 5
6
8
9
7
5
6
8
9
7