0% found this document useful (0 votes)
163 views11 pages

Using Quadrature Encoders With E Series DAQ Boards: Application Note 084

data
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
163 views11 pages

Using Quadrature Encoders With E Series DAQ Boards: Application Note 084

data
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Application Note 084

Using Quadrature Encoders


with E Series DAQ Boards
Introduction
The DAQ-STC, the System Timing Controller device, is used on National Instruments E Series MIO DAQ boards as
the timing engine for data acquisition and control operations. The DAQ-STC includes two general-purpose
counter/timers that are useful for a wide variety of applications. This application note describes how you can use the
DAQ-STC counter/timers to interface to quadrature encoders.

Encoders
An encoder is a device that converts linear or rotary displacement into digital or pulse signals. The most popular
type of encoder is the optical encoder, which consists of a rotating disk, a light source, and a photodetector (light
sensor). The disk, which is mounted on the rotating shaft, has patterns of opaque and transparent sectors coded into
the disk (see Figure 1). As the disk rotates, these patterns interrupt the light emitted onto the photodetector,
generating a digital or pulse signal output.

Figure 1. Optical Encoder

____________________________
Product and company names are trademarks or trade names of their respective companies.
341124A-01

Copyright 1996 National Instruments Corporation. All rights reserved.

May 1996

There are two general types of encoders absolute and incremental encoders.
Absolute Encoders An absolute encoder generates a unique word pattern for every position of the shaft. The
tracks of the absolute encoder disk, generally four to six, commonly are coded to generate binary code, binary-coded
decimal (BCD), or gray code outputs. Absolute encoders are most commonly used in applications where the device
will be inactive for long periods of time, there is risk of power down, or the starting position is unknown.
Incremental Encoders An incremental encoder generates a pulse, as opposed to an entire digital word, for each
incremental step. Although the incremental encoder does not output absolute position, it does provide more
resolution at a lower price. For example, an incremental encoder with a single code track, referred to as a
tachometer encoder, generates a pulse signal whose frequency indicates the velocity of displacement. However, the
output of the single-channel encoder does not indicate direction. To determine direction, a two-channel, or
quadrature, encoder uses two detectors and two code tracks.

Quadrature Encoders
The most common type of incremental encoder uses two output channels (A and B) to sense position. Using two
code tracks with sectors positioned 90 out of phase (Figure 2), the two output channels of the quadrature encoder
indicate both position and direction of rotation. If A leads B, for example, the disk is rotating in a clockwise
direction. If B leads A, then the disk is rotating in a counter-clockwise direction. Therefore, by monitoring both the
number of pulses and the relative phase of signals A and B, you can track both the position and direction of rotation.
In addition, some quadrature detectors include a third output channel, called a zero or reference signal, which
supplies a single pulse per revolution. This single pulse can be used for precise determination of a reference
position.

Figure 2. Quadrature Encoder Output Channels A and B

The DAQ-STC Counter/Timer An Overview


To meet the demands of today's high-performance data acquisition and control applications, National Instruments
developed the Data Acquisition System Timing Controller (DAQ-STC), which integrates all data acquisition
counter/timer functionality into a single ASIC. Designed primarily for use on multifunction input and output DAQ
boards, the DAQ-STC includes 10 counter/timer devices, eight of which are designed to control the timing of analog
input and analog output operations. The remaining two counter/timers are 24-bit up/down counter/timers available
for a wide variety of timing and counting applications. The DAQ-STC is included on all National Instruments E
Series MIO boards, including plug-in boards for ISA and PCI bus, and PCMCIA cards.
Each of the two 24-bit counter/timers of the DAQ-STC includes three input signals (SOURCE, GATE, and
UP_DOWN) and two output signals (OUT and INTERRUPT), as shown in Figure 3.

Figure 3. Simplified Counter/Timer Model of DAQ-STC

Using Quadrature Encoders with the DAQ-STC


While the DAQ-STC includes a number of features useful for a large variety of timing and counting applications, its
up/down counting feature is particularly convenient for encoders.
When using the DAQ-STC in event-counting mode, connect the pulse signal to be counted to the SOURCE input.
When armed, the DAQ-STC count register increments (or decrements) on each transition at the SOURCE input
(configurable for rising or falling edges). In addition, you can configure the DAQ-STC to count up, count down, or
count up or down as determined by the state of the UP_DOWN input.
When using quadrature encoders with the DAQ-STC, you have two choices. First, for simple applications, you can
connect the encoder directly to the DAQ-STC, without any extra logic or signal conditioning. Although simple to
implement, this configuration has the disadvantage of not being able to discern between stationary vibration of the
encoder and real rotation. Second, you can interface the encoder to the DAQ-STC using a using a quadrature clock
converter IC. This method prevents errors due to jitter and debouncing, and provides higher measurement
resolution. These two methods are described below.

Note on Signal Levels


The DAQ-STC, as well as the quadrature clock converter described here, provides TTL and CMOS compatible
inputs and outputs. If your encoder provides outputs that are a different signal level, 24 V for example, then you
may damage your equipment by connecting it directly to the DAQ-STC or clock converter. Therefore, you must
either use an encoder that outputs TTL/CMOS signals, or use appropriate signal conditioning to convert the signal
level and isolate the TTL/CMOS circuitry from high voltages. In either case, you may want to optically isolate your
A and B signal lines to protect your DAQ board, PC, and operator from accidental application of high voltages.

Method 1. Direct Connection to DAQ-STC (No Signal Conditioning)


For simple applications, you can connect quadrature encoders to the DAQ-STC counter/timeravailable on National
Instruments E Series DAQ boards. By taking advantage of the UP_DOWN control input, you can use the
DAQ-STC to count up or down depending on the direction of shaft rotation.
To connect the encoder to the DAQ-STC, wire Channel A output of the encoder to the SOURCE input of the
DAQ-STC and wire Channel B output of the encoder to the UP_DOWN input. Figure 4 illustrates these
connections for an AT-MIO-16E-2 board. Note that the UP_DOWN input is accessed on the DIO6 pin for counter 0
or DIO7 for counter 1.

Figure 4. Direct (Nonconditioned) Encoder Connection to E Series DAQ Board


In this configuration, the counter will increment on state transitions (default low-to-high) on Channel A. When a
Channel A low-to-high transition occurs, the state of Channel B will be high or low, depending directly on the
direction of rotation. Therefore, the DAQ-STC counter will increment when the encoder rotates in one direction,
and decrement when the encoder rotates in the opposite direction.

Limitations of Method 1
While the configuration described above is very simple to implement, this method has a couple of potentially serious
drawbacks. If the encoder disk is not rotating, but is vibrating enough back and forth to cause active transitions on
Channel A, then each movement will be incorrectly counted. The effect of this dither motion is illustrated in Figure
5. As the encoder disk moves back and forth across A2, Channel B remains low but the DAQ-STC counter
continues to increment the count, resulting in an incorrect position reading. The quadrature clock converter device
described in the next section solves this problem.
Another problem results when encoder outputs include noise or jitter that is large enough to be erroneously counted
as a valid state transition. You can solve this problem with lowpass filters on the A and B signal outputs.

Figure 5. Dithering Effect of Vibration

Method 2. Using Clock Converter with DAQ-STC for Reliable Measurements


You can greatly improve the reliability and quality of encoder measurements by using a clock converter device that
conditions the encoder signals to prevent errors due to vibration, noise, and jitter. For example, the LS7084
quadrature clock converter from LSI Computer Systems, Inc. converts the A and B signals from an encoder into a
clock and up/down signal that you can connect directly to the DAQ-STC. The LS7084 includes lowpass filters to
prevent miscounts due to noise and jitter. In addition, the LS7804 uses dual one-shots to prevent the miscounting
produced by vibration, or dither, as described in the previous section. The complete data sheet, with timing
diagrams, is included at the end of this application note.
As shown in Figure 2 of the LS7084 data sheet (page 10), the CLK output, when in X4 mode, will pulse once on
every transition of either the A or B signals. The UP/DN output indicates the direction of rotation. You can connect
the A and B signals from a quadrature encoder directly to the LS7084, and connect the CLK and UP/DN outputs
directly to the SOURCE and UP_DOWN inputs of the DAQ-STC. Figure 6 illustrates the connections.

Figure 6. Encoder Connection to DAQ-STC using LS7084 Clock Converter


The value of the bias resistor, RB, controls the pulse width of the CLK output. A 100 k resistor will produce a
pulse width of about 400 ns when using a voltage supply, VDD , of 5 VDC.

Using Encoders with 9513 or 8253/8254 Counter/Timers


The up/down counting feature of the DAQ-STC is very useful for quadrature encoders. The AM9513 and
8253/8254 counter/timers, used on some MIO Series and Lab/1200 Series DAQ products, do not include up/down
counting capabilities. However, you may be able to use the LS7083, which is similar to the LS7084, to interface to
encoders with these counter/timers. Similar to the LS7084, the LS7083 output signals include a UPCK signal which
pulses when the encoder is rotating in the up direction, and a DNCK signal which pulses when the encoder is
rotating in the down direction. By connecting these two output signals to the source or clock pins of two distinct
counters on an AM9513 or 8253/8354, you can determine the total rotation by determining the difference between
the two counts. One drawback of this method is that you must monitor the counts to determine when a counter hits
full count and rolls over, so that the difference calculation is not distorted.

Software
You control and use National Instruments DAQ products with NI-DAQ, a software driver that you can use with
LabVIEW, LabWindows/CVI, ComponentWorks, or a third-party programming language. NI-DAQ includes
function calls to use the DAQ-STC device for counting and timing.
LabVIEW The How to Count.vi example that is included with the LabVIEW package includes several
programming examples for counting applications with the DAQ-STC. Counting method number 3, count up and
down, can be used with the quadrature encoder setups described in this application note. In short, this method
enables the up/down counting by setting the count direction parameter in the CTR MODE CONFIG function to a
value of 3.
LabWindows/CVI and NI-DAQ When using LabWindows/CVI, or NI-DAQ with other programming languages,
you program the DAQ-STC with GPCTR function calls. In particular, to configure a DAQ-STC counter for
up/down counting, use the GPCTR_Change_Parameter function with parameter type set to ND_UP_DOWN and
parameter value set to ND_HARDWARE.
Once the DAQ-STC is properly configured and your software program correctly retrieves the count from the
counter, you can convert the count into rotation by using one of the following simple formulas:

10

11

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy