12
|
ni.com
|
BNC-2120 Installation Guide
Using the Quadrature Encoder
The BNC-2120 contains a mechanical quadrature encoder circuit that produces 96 pulses per
encoder revolution. Two outputs, PULSES and UP/DN, are at the screw terminals located below
the quadrature encoder knob.
PULSES outputs a pulse train generated by rotating the encoder shaft. It provides four pulses per
one mechanical click of the encoder. UP/DN outputs a high or a low signal indicating rotation
direction. When the direction is counterclockwise, UP/DN is low. When the direction is
clockwise, UP/DN is high.
To use the quadrature encoder with counter 0 of the DAQ device, connect the PULSES terminal
to PFI 8 and connect the UP/DN terminal to the P0.6 digital I/O terminal, the up/down pin of
counter 0. To use the quadrature encoder with counter 1, connect the PULSES terminal to PFI 3
and connect the UP/DN terminal to the P0.7 digital I/O terminal, the up/down pin of counter 1.
Refer to Table 2 for more information about PFI 3 and PFI 8. Refer to the
section for more information about the digital I/O terminals and LEDs.
You can use the Count Digital Events VI from the LabVIEW Example Finder (
Hardware Input
and Output»DAQmx»Counter Measurements»Count Digital Events
) with the BNC-2120
quadrature encoder. After opening the VI, select
Externally Controlled
in the Count Direction
control. The VI retrieves the count from the counter. You can convert the count into total degrees
rotated using the following formula:
Total Degrees Rotated
=
PULSES
×
3.75°/
pulse
where
3.75°/
pulse
= 360°/96
pulses
Calculate the number of revolutions and remaining degrees by dividing the total degrees rotated
by 360
°
. The calculated quotient is equal to the number of revolutions and the remainder is equal
to the remaining degrees.