![background image](http://html1.mh-extra.com/html/national-instruments/usb-6210/usb-6210_user-manual_3656406114.webp)
Chapter 8
Counters
©
National Instruments Corporation
8-17
•
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
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
high d
u
ring at least a portion of the phase yo
u
specify for reload. For
instance, in Fig
u
re 8-17, channel Z is never high when channel A is high
and channel B is low. Th
u
s, the reload m
u
st occ
u
r in some other phase.
In Fig
u
re 8-17, the reload phase is when both channel A and channel B are
low. The reload occ
u
rs when this phase is tr
u
e and channel Z is high.
Incrementing and decrementing takes priority over reloading. Th
u
s, when
the channel B goes low to enter the reload phase, the increment occ
u
rs first.
The reload occ
u
rs within one maxim
u
m timebase period after the reload
phase becomes tr
u
e. After the reload occ
u
rs, the co
u
nter contin
u
es to co
u
nt
as before. The fig
u
re ill
u
strates channel Z reload with X4 decoding.
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