0.60

ReferenceHardwareNational InstrumentsAnalog read task

NI analog read task

Read voltages, currents, temperatures, and other sensor signals from NI devices into channels.

An NI analog read task reads the analog inputs of NI devices into channels. Each channel has a type, such as voltage, current, thermocouple, or bridge, and NI-DAQmx converts the signal to the units of that type. For example, one task can record pressure transducers on an NI 9205 and thermocouples on an NI 9211 in the same chassis.

Before you start, you need configured devices.

Channels and timing

Each channel reads one port of one device. A task can use the modules of one chassis, and all of them must be on the same Driver. The task samples every channel on the device clock, at the Sample rate. See timing.

Only one running task can use the analog inputs of a module. A second task on the same module fails to start with an NI-DAQmx error that says the resource is reserved.

Create an NI analog read task

Enterprise
  1. In the devices toolbar, right-click a device and select Create analog read task.
  2. Set Sample rate and Stream rate.
  3. Click Add channel. In Source, select the Device and the Port.
  4. In Signal, select the Channel type, then set its fields. See the channel reference.
  5. Click (Start).

The Console creates the channels. For a device with the identifier dev1, port 0 gives dev1_ai_0, and the built-in temperature sensor gives dev1_ai_temp. Each device has an index channel, such as dev1_ai_time.

Tare channels

Tare sets the current value of a channel to zero. The task must be running.

  1. In the channel list, click Tare on a channel. To tare several channels, select them, right-click, and select Tare.
  2. The values of those channels start from zero.

Task options

Console label Python field Default Notes
Sample rate sample_rate 10 Hz Up to 1,000,000 Hz in the Console. Each device has a minimum.
Stream rate stream_rate 5 Hz Up to 20,000 Hz. See read tasks.
Data saving data_saving_disabled On See data saving.
Auto start auto_start Off Starts the task each time the Driver starts.

Channel reference

Every channel has a channel, the Synnax channel that records the value, a device, the key of the device (Device), and a port (Port). The built-in temperature sensor has no port. In Python, a channel with no device uses the device of the task.

Each table shows the Console label of a setting, with its Python field under it. The Notes column lists the values that code uses, such as MetersPerSecondSquared. The Console shows the same values as symbols, such as m/s². Every type except the temperature types also has Custom scaling.

Voltage

Python AIVoltageChannelTypeScript ai_voltageNI-DAQmx

Reads a voltage.

Setting Default Notes
Range min_val, max_val 0 to 1 In volts.
Terminal configuration terminal_config Cfg_Default Cfg_Default, RSE, NRSE, Diff, PseudoDiff.

Custom scaling

Channels with Custom scaling convert the raw value before the Driver writes it. In the Console, the options are in the Scale section of the channel. In code, set custom_scale to one of these scales:

Console option Python class Fields
None NoneScale No scaling. This is the default.
Linear LinearScale Slope (slope, 1) and Y-intercept (y_intercept, 0).
Map MapScale Pre-scaled min and max to Scaled min and max (pre_scaled_min, pre_scaled_max, scaled_min, scaled_max).
Polynomial PolynomialScale Forward coefficients (forward_coeffs) and Reverse coefficients (reverse_coeffs), from c0 up.
Table TableScale Pre-scaled and Scaled pairs (pre_scaled_vals, scaled_vals). A CSV file can fill them.

Every scale except None also has Prescaled units (pre_scaled_units, Volts) and Scaled units (scaled_units).

Troubleshooting

For other problems, see Configure an NI device and Troubleshoot hardware.