Chapter 8
Counters
8-16
ni.com
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
•
X4 Encoding
—Similarly, the co
u
nter increments or decrements on
each edge of channels A and B for X4 encoding. Whether the co
u
nter
increments or decrements depends on which channel leads the other.
Each cycle res
u
lts in fo
u
r increments or decrements, as shown in
Fig
u
re 8-16.
Figure 8-16.
X4 Encoding
Channel Z Behavior
Some q
u
adrat
u
re encoders have a third channel, channel Z, which is also
referred to as the index channel. A high level on channel Z ca
u
ses the
co
u
nter to be reloaded with a specified val
u
e in a specified phase of the
q
u
adrat
u
re cycle. Yo
u
can program this reload to occ
u
r in any one of the
fo
u
r phases in a q
u
adrat
u
re cycle.
Channel Z behavior—when it goes high and how long it stays
high—differs with q
u
adrat
u
re encoder designs. Yo
u
m
u
st refer to the
doc
u
mentation for yo
u
r q
u
adrat
u
re encoder to obtain timing of channel Z
with respect to channels A and B. Yo
u
m
u
st then ens
u
re that channel Z is
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
Ch A
Ch B
Co
u
nter V
a
l
u
e 5 6
8 9 10
10
11 11
12 12
1
3
1
3
7
5
6
8 7
9