Documentation Center

  • Trial Software
  • Product Updates

InputRange

Specify range of analog input subsystem

Description

    Note:   You cannot use the legacy interface on 64–bit MATLAB®. See Session-Based Interface to acquire and generate data.

InputRange is a two-element vector that specifies the range of voltages that can be accepted by the analog input (AI) subsystem. You should configure InputRange so that the maximum dynamic range of your hardware is utilized.

If an input signal exceeds the InputRange value, then an overrange condition occurs. Overrange detection is enabled only if the analog input object is running and a value is specified for the InputOverRangeFcn property. For many devices, the input range is expressed in terms of the gain and polarity.

AI subsystems have a finite number of InputRange values that you can set. If an input range is specified but does not match a valid range, then the next highest supported range is automatically selected by the engine. If InputRange exceeds the range of valid values, then an error is returned. Use the daqhwinfo function to return the input ranges supported by your board.

Because the engine can set the input range to a value that differs from the value you specify, you should return the actual input range for each channel using the get function or the device object display summary. Alternatively, you can use the setverify function, which sets the InputRange value and then returns the actual value that is set.

    Note   If your hardware supports a channel gain list, then you can configure InputRange for individual channels. Otherwise, InputRange must have the same value for all channels contained by the analog input object.

You should use InputRange in conjunction with the SensorRange property. These two properties should be configured such that the maximum precision is obtained and the full dynamic range of the sensor signal is covered.

Characteristics

Usage

AI, per channel

Access

Read/write

Data type

Two-element vector of doubles

Read-only when running

Yes

Values

The default value is supplied by the hardware driver.

Examples

Create the analog input object ai for a National Instruments® board, and add two hardware channels to it.

ai = analoginput('nidaq','Dev1');
addchannel(ai,0:1);

You can return the input ranges supported by the board with the InputRanges field of the daqhwinfo function.

out = daqhwinfo(ai);
out.InputRanges
ans =
   -0.0500    0.0500
   -0.5000    0.5000
   -5.0000    5.0000
  -10.0000   10.0000

To configure both channels contained by ai to accept input signals between -10 volts and 10 volts:

ai.Channel.InputRange = [-10 10];

Some devices allow you to set each channel's InputRange property independently:

ai.Channel(1).InputRange = [-0.05    0.05];
ai.Channel(2).InputRange = [-10 10];

Alternatively, you can use the setverify function.

ActualRange = setverify(ai.Channel,'InputRange',[-10 10]);
Was this topic helpful?