Professional Documents
Culture Documents
Lesson 3 DAQ
Lesson 3 DAQ
Experimental Methods
Module code DME 811
Dr Riaz A Mufti
(B.Sc, M.Sc Eng (UK), PhD (UK), CEng (UK), MIMechE (UK), P.E (PEC))
Analog Input
Sampling Signals
• To acquire an analog signal, you must first convert an analog signal into its digital
representation. In practice, this is implemented by using an analog-to-digital (A/D) converter.
• Consider an analog signal x(t) that is sampled every Δt seconds. The time interval Δt is
known as the sampling interval or sampling period. Its reciprocal, 1/Δt, is known as the
sampling frequency, with units of samples/second.
• Each of the discrete values of x(t) at t = 0, Δt, 2Δt, 3Δt, etc., is known as a sample. Thus,
x(0), x(Δt), x(2Δt), ..., are all samples.
• The following figure shows an analog signal and its corresponding sampled version. The
sampling interval is Δt. The samples are defined at discrete points in time.
Sampling Signals
• Individual samples are represented by: x[i] = x(it), for i = 0, 1, 2, …
• If N samples are obtained from signal x(t): X = {x[0], x[1], x[2], …x[N-
1])
• The sequence X = {x[i]} is indexed on i and does not contain sampling
rate information
Sampling Considerations
NOTE: You must sample between 5–10 times greater than the
maximum frequency component of your signal to accurately
represent the SHAPE of your signal.
Nyquist Example
Aliased Signal
Adequately Sampled
for Frequency Only
(Same # of cycles)
100Hz Sine Wave Sampled at 200Hz
Adequately Sampled
for Frequency and
Shape
100Hz Sine Wave Sampled at 1kHz
DAQmx Read Function
1. Select Settings
Analog
1 Channel
1 Sample
Waveform
ni.com/training
DAQmx Read Function
1. Select Settings
RAM
• Remember that PCI bus is shared among different devices in
the system and it transfers data in bursts. The maximum burst
rate is 32 bit x 33 MHz = 132 MB/s.
• We rely on the PCI bus bandwidth when transfer data from the
data acquisition device to the PC RAM. If the rate of data to
the onboard memory is faster than the rate of data transferred LabVIEW
out through the PCI bus, then the onboard memory will report
an overflow. The larger the onboard memory, the less
dependency we have on the PCI bus bandwidth since we can
hold more data while waiting for the PCI bus to burst it out.
Finite Buffered Acquisition Theory
Bucket Theory
Think of your PC buffer as a
bucket that is filling up with water
Data – Buffer size = size of the bucket
– Sample rate controls how fast water flows into
the bucket
– When the bucket is full you dump it into a
another bucket (LabVIEW buffer)
PC Bucket
Setting the Buffer Size for Finite Acquisition
DAQmx VIs:
− Timing VI
o Number of samples per channel
equals the buffer size
» Typically only used for finite
operations
o Does not affect number of samples
read at any one time
Configuring the Number of Samples to Read
Number of samples per channel input:
• If left unwired or set to -1, NI-DAQmx automatically determines
how many samples to read, based on the task configuration
• For finite acquisition, if the input is unwired or -1, NI-DAQmx
uses the Read All Available Samples property to determine how
many samples to read
Finite Buffered Acquisition
• Perform a hardware-timed, finite buffered acquisition
• Highly recommended for most applications
• Set the buffer size, sampling mode, sampling rate, and number
of samples to read per channel
Configure buffer,
sampling mode,
and rate