Chapter 4
Analog Input
4-8
ni.com
•
Avoid Scanning Faster Than Necessary
—Designing yo
u
r system to
scan at slower speeds gives the NI-PGIA more time to settle to a more
acc
u
rate level. Consider the following examples:
–
Example 1—Averaging many AI samples can increase the
acc
u
racy of the reading by decreasing noise effects. In general,
the more points yo
u
average, the more acc
u
rate the final res
u
lt.
However, yo
u
may choose to decrease the n
u
mber of points yo
u
average and slow down the scanning rate.
S
u
ppose yo
u
want to sample 10 channels over a period of 20 ms
and average the res
u
lts. Yo
u
co
u
ld acq
u
ire 250 points from each
channel at a scan rate of 125 kS/s. Another method wo
u
ld be to
acq
u
ire 500 points from each channel at a scan rate of 250 kS/s.
Both methods take the same amo
u
nt of time. Do
u
bling the n
u
mber
of samples averaged (from 250 to 500) decreases the effect of
noise by a factor of 1.4 (the sq
u
are root of 2). However, do
u
bling
the n
u
mber of samples (in this example) decreases the time the
NI-PGIA has to settle from 8
μ
s to 4
μ
s. In some cases, the slower
scan rate system ret
u
rns more acc
u
rate res
u
lts.
–
Example 2—If the time relationship between channels is not
critical, yo
u
can sample from the same channel m
u
ltiple times and
scan less freq
u
ently. For example, s
u
ppose an application req
u
ires
averaging 100 points from channel 0 and averaging 100 points
from channel 1. Yo
u
co
u
ld alternate reading between
channels—that is, read one point from channel 0, then one point
from channel 1, and so on. Yo
u
also co
u
ld read all 100 points from
channel 0 then read 100 points from channel 1. The second
method switches between channels m
u
ch often and is affected less
by settling time.
Analog Input Data Acquisition Methods
When performing analog inp
u
t meas
u
rements, yo
u
either can perform
software-timed or hardware-timed acq
u
isitions:
•
Software-Timed Acquisitions
—With a software-timed acq
u
isition,
software controls the rate of the acq
u
isition. Software sends a separate
command to the hardware to initiate each ADC conversion. In
NI-DAQmx, software-timed acq
u
isitions are referred to as having
on-demand timing. Software-timed acq
u
isitions are also referred to as
immediate or static acq
u
isitions and are typically
u
sed for reading a
single sample of data.