Session-Based Interface Using National Instruments Devices

Session-Based Interface and Legacy Interface

You can use National Instruments® devices with both the session-based interface and the legacy interface. To see which interface you need to use, refer to National Instruments Usage Based on Functionality. For more information on the session-based information, see Session-Based Interface.

daqhwinfo('nidaq')
           AdaptorDllName: [1x63 char]
        AdaptorDllVersion: '3.0 (R2011b)'
              AdaptorName: 'nidaq'
               BoardNames: {'PCI-4472'}
        InstalledBoardIds: {'Dev4' '1'}
    ObjectConstructorName: {2x3 cell}

If the daqhwinfo('nidaq') command returns a warning about session-based interface, you have devices that require the session-based interface.

 daqhwinfo('nidaq')

Warning: Devices were detected that require the DAQ Session Based Interface.
For more information, see documentation on the session-based interface
 

ans = 

           AdaptorDllName: [1x103 char]
        AdaptorDllVersion: '3.0 (R2011b)'
              AdaptorName: 'nidaq'
               BoardNames: {1x13 cell}
        InstalledBoardIds: {1x13 cell}
    ObjectConstructorName: {13x3 cell}

Refer to About the Session-Based Interface to learn how to communicate with CompactDAQ devices.

Is My NI-DAQ Driver Supported

Data Acquisition Toolbox™ software is compatible only with specific versions of the NI-DAQ driver and is not guaranteed to work with any other versions. For a list of the NI-DAQ driver versions that are compatible with Data Acquisition Toolbox software, refer to the product page on the MathWorks Web site at http://www.mathworks.com/products/daq/supportedio.html and click on the link for this vendor.

To see your installed driver version in the session-based interface, type:

v = daq.getVendors

v = 

Number of vendors: 2

index    ID    Operational         Comment         
----- -------- ----------- ------------------------
1     ni       true        National Instruments
2     digilent false       Click here for more info

Properties, Methods, Events

Additional data acquisition vendors may be available as downloadable support packages.
Open the Support Package Installer to install additional vendors.

If the version in the DriverVersion field does not match the minimum requirements specified on the product page on the MathWorks Web site, you need to update your drivers.

If your driver is incompatible with Data Acquisition Toolbox , verify that your hardware is functioning properly before updating drivers. If your hardware is not functioning properly, you are using unsupported drivers. Visit the National Instruments Web site at http://www.ni.com/ for the latest NI-DAQ drivers.

To find driver version in the National Instruments' Measurement & Automation Explorer: . .

  1. Click Start > Programs > National Instruments > Measurement & Automation Explorer.

  2. Select Help > System Information.

Why Doesn't My Hardware Work?

Use the Test Panel to troubleshoot your National Instruments hardware . The Test Panel allows you to test each subsystem supported by your device, and is installed as part of the NI-DAQmx driver software. Right-click the device in the Measurement & Automation Explorer and choose Test Panel.

For example, to verify that the analog input subsystem on your PCIe-6363 device is operating, . connect a known signal (similar to that produced by a function generator) to one or more channels, using a screw terminal panel.

If the Test Panel does not provide you with the expected results for the subsystem, and you are sure that your test setup is configured correctly, then the hardware is not performing correctly.

For your National Instruments hardware support visit their Web site at http://www.ni.com/.

Cannot Create Session

If you try to create a session using daq.createSession, and you see the following error:

??? The vendor 'ni' is not known. Use 'daq.getVendors()' for a list of vendors.
  1. get vendor information by typing:

    v = daq.getVendors
    
    v = 
    
    Data acquisition vendor 'National Instruments':
    
                ID: 'ni'
          FullName: 'National Instruments'
    AdaptorVersion: '2.17 (R2010b)'
     DriverVersion: '9.1 NI-DAQmx'
     IsOperational: true
    

    If you do not see output like the one shown, see Cannot Find Hardware Vendor.

Why Was My Session was Deleted?

This warning:

A session was deleted while it was running.

occurs when you start background operations in the session and the session is silently deleted. This could be caused by the session going out of scope at the end of a MATLAB function, before the background task completes. To avoid this, insert a pause after startBackground.

Cannot Find Hardware Vendor

If you try to get vendor information using daq.getVendors in the session-based interface, and receive one of the following errors:

  • NI-DAQmx driver mismatch:

    Diagnostic Information from vendor: NI: There was a driver error while
    loading the MEX file to communicate with National Instruments hardware.
    It is possible that the NI-DAQmx driver is not installed or is older than
    the required minimum version of '8.7'.

    Install the NI-DAQmx driver of version specified in the error message.

    If you have a version of the NI-DAQmx driver already installed, update your installation to the minimum required version suggested in the error message.

  • No vendors found:

    No data acquisition vendors available.

    Reinstall Data Acquisition Toolbox software.

  • Corrupted or missing toolbox components:

    Diagnostic Information from vendor: NI: The required MEX file to communicate
    with National Instruments hardware is not in the expected location:
    

    Reinstall Data Acquisition Toolbox software.

    Diagnostic Information from vendor: NI: The required MEX file to communicate
    with National Instruments hardware exists but appears to be corrupt:
    

    Reinstall Data Acquisition Toolbox software.

Cannot Find Devices

If you try to find information using daq.getDevices and:

  • Do not see the expected device listed. For example, if you are looking for an NI 9263 and NI 9265 and you type:

    d = daq.getDevices
    
    d = 
    
    Data acquisition devices:
    
    index Vendor Device ID          Description          
    ----- ------ --------- ------------------------------
    1     ni     cDAQ1Mod1 National Instruments NI 9205
    2     ni     cDAQ1Mod3 National Instruments NI 9203
    3     ni     cDAQ1Mod4 National Instruments NI 9201
    4     ni     cDAQ1Mod6 National Instruments NI 9213
    6     ni     cDAQ1Mod8 National Instruments NI 9265
    

    To refresh the toolbox, type

    daqreset

    If you still do not see the devices, go to the National Instruments Measurement & Automation Explorer (NI MAX) and examine the devices installed on your CompactDAQ chassis.

  • Receive one of the following error

    • No data acquisition devices available.

      • Go to NI MAX and examine the devices installed on your CompactDAQ chassis.

      • If you cannot see your devices in NI MAX, check to see if you have powered on and connected your chassis.

      • If you have powered on and connected your chassis and issued daqreset, and you can see the devices in NI MAX, reinstall Data Acquisition Toolbox software.

    • ??? The requested subsystem 'AnalogInput' does not exist on this device.

      You could be:

    • ??? The requested subsystem 'AnalogOutput' does not exist on this device.

      You could be:

  • If you are using NI 9402 with the counter/timer subsystem with the cDAQ-9172 chassis, you must plug the module into slots 5 or 6 only. If you plug the module into one of the other slots, it will not show any counter/timer subsystem.

  • If you are using an Ethernet CompactDAQ chassis, reserve the chassis in National Instruments Measurement & Automation Explorer first. Only one system can reserve this chassis at a time.

What is a Reserved Hardware Error?

If you receive the following error:

??? The hardware associated with this session is reserved. If you are using it in another
session use the release function to unreserve the hardware. If you are using it in an
external program exit that program. Then try this operation again. 

Identify the session that is currently not using this device, but has reserved it and release the associated hardware resources. If the device is reserved by:

Another session in the current MATLAB® program.

Do one of the following:

  • Use release to release the device from the session that is not using the device.

  • Delete the session object.

Another session in a separate MATLAB program.

Do one of the following:

  • Use release to release the device from the session that is not using the device.

  • Delete the session object.

  • Exit the MATLAB program.

Another application.

Exit the other application.

In none of these measures work, reset the device from NI MAX.

    Note:   Your network device may also appear as unsupported in the device information if it is reserved or disconnected.

What Are Devices With an Asterisk (*)?

If you get device information and see a device listed with an asterisk (*) next to it, then the toolbox does not support this device.

d = daq.getDevices

d = 

Data acquisition devices:

index Vendor Device ID           Description          
----- ------ --------- -------------------------------
1     ni     cDAQ1Mod1 National Instruments NI 9401
2     ni     cDAQ1Mod7 National Instruments NI 9219
3     ni     cDAQ2Mod1 National Instruments NI 9205
4     ni     cDAQ2Mod2 National Instruments NI 9263
5     ni     cDAQ2Mod3 National Instruments NI 9203
6     ni     cDAQ2Mod4 National Instruments NI 9201
7     ni     cDAQ2Mod5 National Instruments NI 9265
8     ni     cDAQ2Mod6 National Instruments NI 9213
9     ni     cDAQ2Mod7 National Instruments NI 9227
10    ni     cDAQ2Mod8 National Instruments NI 9422
11    ni     Dev2      National Instruments PCIe-6363
12    ni     Dev3      National Instruments USB-6255
13    ni     Dev4      National Instruments USB-9233
14    ni     Dev5      * National Instruments PCI-6601
15    ni     Dev6      National Instruments PCI-6220
16    ni     Dev8      * National Instruments PCI-6509

* Device currently not supported. See documentation on Unsupported Devices for more information.
  • Make sure your network device is not reserved and not disconnected.

  • Go to the Supported Hardware area in Data Acquisition Toolbox page on the MathWorks® Web site for a list of supported devices.

Network Devices Appears With an Asterisk (*)

  • If your network device appears as unsupported or unavailable, make sure that the device is connected and reserved in National Instruments Measurement and Automation Explorer. Issue daq.reset to reset devices settings.

  • If you see this timeout error when communicating with a network device:

    Network timeout error while communicating with device 'cDAQ9188-1595393Mod4' 

    reconnect the device in National Instruments Measurement and Automation Explorer and issue daq.reset to reset devices settings.

ADC Overrun Error with External Clock

If you see this error when you synchronize acquisition using an external clock:

ADC Overrun Error: If you are using an external clock, make sure that the clock frequency matches session rate. 
  • check your external clock for the presence of noise or glitches.

  • check the frequency of your external clock. Make sure it matches the session's rate.

Cannot Add Clock Connection to PXI Devices

When you try to synchronize operations using a PXI 447x series device, you will see this error:

"DSA device 'PXI1Slot2' does not support sample clock synchronization. Check device's user manual.

National Instruments DSA devices like the PXI 447x, do not support sample clock synchronization. You cannot synchronize these devices in the session-based interface using addClockConnection.

Cannot Complete Long Foreground Acquisition

When you try to acquire data in the foreground for a long period of time, you may get an out-of-memory error. Switch to background acquisitions and process data as it is received or save the data to a file to mitigate this issue.

Cannot Use PXI 4461 and 4462 Together

You cannot use PXI 4461 and 4462 together for synchronization, when PXI 4461 is in the timing slot of the chassis.

Counters Restart When You Call prepare

Counters stop running in the background when you call prepare to perform clocked operations. This operation resets counters and restarts them when the new operation starts.

Cannot Get Correct Scan Rate with Digilent Devices

The scan rate when you use a Digilent device, can be limited by the hardware's buffer size. See Digilent Analog Discovery Devices for more information on maximum and minimum allowable rates.

Cannot Simultaneously Acquire and Generate with myDAQ Devices

You cannot acquire and generate synchronous data using myDAQ devices because they do not share a hardware clock. If you have both input and output channel s in a session and you start the session, you will see near-simultaneous acquisition and generation. See Automatic Synchronization for more information.

Counter Single Scan Returns NaN

An input single scan on counter input channels may return a NaN. If this occurs:

  • make sure that the signal voltage complies with TTL voltage specifications.

  • Make sure the channel frequency is within the specified frequency range.

External Clock Will Not Trigger Scan

Adding an external clock to your session may not trigger a scan unless you set the session's rate to match the expected external clock frequency.

Why Does My S/PDIF Device Timeout?

S/PDIF audio ports appear in the device list even when you have no devices plugged in.

  • If you add this device (port) to your session and you have no device plugged into the port, the operation will time out.

  • If you have a device plugged into the S/PDIF port, you may need to match the session rate to the device scan rate to get accurate readings. Refer to your device documentation for information.

Audio Output Channels Display Incorrect ScansOutputByHardware Value

If you have downloaded the Windows Audio support package with R2014a, you may see incorrect values for the sessions ScansOutputByHardware property. The hardware outputs the scans as specified and the property may incorrectly report this number. To correct it, execute this code:

s = daq.createSession('directsound')
scansOutputByHardware_incorrect = s.ScansOutputByHardware; 
correction = s.NotifyWhenScansQueuedBelow - 1; 
scansOutputByHardware_corrected = scansOutputByHardware_incorrect + correction; 
Was this topic helpful?