Working with the Session-Based Interface

Session Architecture

The session-based interface uses a session object that contains:

  • Analog input channels and properties

  • Digital input channels and properties (non-clocked)

  • Counter input channels and properties

  • Analog output channels and properties

  • Digital output channels and properties (non-clocked)

  • Counter output channels and properties

  • Session properties

Use the session object to interact with the specified device to acquire and generate data at the same time.

Foreground Operations

Use startForeground to start an operation that blocks MATLAB® until the operation completes. For an acquisition, this causes MATLAB to wait for the entire acquisition to complete before it executes your next command. For a generation, this causes MATLAB to wait for the entire data generation to complete before it executes your next command.

Background Operations

Use startBackground to start an operation that allows you to continue working in the MATLAB Command Window and to process data simultaneously. Use listeners to process data in MATLAB as the hardware continues to operate.

Counter Channels

Use with counter channels to:

  • Count events and pulses.

  • Measure frequency.

  • Generate pulses.

  • Use a hardware clock to measure pulses and frequency at specified intervals.

The counters on a channel start running as soon as you add the channel to a session. All counters in a session reset to the initial count when:

  • A foreground or background acquisition starts. This operation automatically resets counters and starts the acquisition.

  • You use resetCounters on the daq.Session object to reset and restart counters automatically.

  • Properties on the counter channel or the session object change.

  • An error occurs during the session operation.

Foreground and background acquisitions are clocked operations and require a hardware clock. To provide a clock to your session, add an analog input or output channel on the same chassis as the counter input channel. The session object automatically adds an internal clock using the analog input or output subsystem, and enables the clocked operation.

Bridge Channels

A bridge channel measures electrical resistance, and returns data in voltage ratio values. A bridge measurement needs an excitation voltage to return an output. You can use bridge-based sensors to measure physical data such as:

  • Force

  • Load

  • Pressure

  • Strain

  • Torque

See the examples for session-based interface analog input and output for more information.

To convert acquired data to strain measurement, apply the appropriate parameters and formulas.

A bridge can have one, two, or four active resistors or sensing elements, defined as quarter bridge, half bridge, and full bridge respectively.

RTD Channels

Resistance temperature detectors (RTDs) contain pure metals. The resistance of a device with RTD channels increases with the temperature. An RTD device requires excitation current. A typical RTD is slow to respond and has low sensitivity. RTDs also have low nominal resistance, typically around 100 ohms at room temperature. To get a higher precision, use a 3– or 4– wire configuration.

IEPE Channels

Use Integrated Electronics Piezo Electric, or IEPE measurement type with National Instruments® devices that support IEPE excitation, with IEPE sensors which include force sensors, load cells and impact hammers. With this measurement type you can specify IEPE specific properties like ExcitationCurrent and ExcitationSource. It returns voltage data and you must calculate the data in engineering units based on your sensor specifications.

    Note:   To use an accelerometer or a microphone IEPE sensor, use the Accelerometer or Microphone measurement types to get your data gravities or pascals respectively.

Was this topic helpful?