Summary: In this lesson, you will learn how to perform analog input.
Use analog input to perform analog-to-digital (A/D) conversions.
The available analog input measurement types for a task are voltage, temperature, strain, current, resistance, or frequency.
![]() |
Each measurement type has its own characteristics, such as resistor values for current measurements or strain gauge parameters for strain measurements.
When performing analog input, the task can be timed to Acquire 1 Sample, Acquire n Samples, or Acquire Continuously.
Acquiring a single sample is an on-demand operation. In other words, NI-DAQmx acquires one value from an input channel and immediately returns the value. This operation does not require any buffering or hardware timing. For example, if you periodically monitor the fluid level in a tank, you would acquire single data points. You can connect the transducer that produces a voltage representing the fluid level to a single channel on the measurement device and initiate a single-channel, single-point acquisition when you want to know the fluid level.
One way to acquire multiple samples for one or more channels
is to acquire single samples in a repetitive
manner. However, acquiring a single data sample on one or
more channels over and over is inefficient and time
consuming. Moreover, you do not have accurate control over
the time between each sample or channel. Instead you can use
hardware timing, which uses a buffer in computer memory, to
acquire data more efficiently. Programmatically, you need to
include the timing function and specify the sample
rate and the sample mode (finite). As
with other functions, you can acquire multiple samples for a
single channel or multiple channels.
With NI-DAQmx, you also can gather data from multiple channels. For instance, you might want to monitor both the fluid level in the tank and the temperature. In such a case, you need two transducers connected to two channels on the device.
If you want to view, process, or log a subset of the samples
as they are acquired, you need to continually acquire
samples. For these types of applications, set the
sample mode to continuous.
When a device controlled by NI-DAQmx does something, it performs an action. Two very common actions are producing a sample and starting a waveform acquisition. Every NI-DAQmx action needs a stimulus or cause. When the stimulus occurs, the action is performed. Causes for actions are called triggers. The start trigger starts the acquisition. The reference trigger establishes the reference point in a set of input samples. Data acquired up to the reference point is pretrigger data. Data acquired after the reference point is posttrigger data.
"A full introductory course on programming with LabVIEW."