Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

Linux Users Forum - NIWeek 2012 - DAQ Driver Demos

These LabVIEW 2012 examples were created for the Linux Users Forum during NIWeek 2012 to demonstrate how to use NI DAQ hardware on Linux.

Linux DAQ Driver DemoX Series DDK LabVIEW Demo
LinuxDAQDriverDemo.pngXSeriesDDKLabVIEWDemo.png
DescriptionDescription

Uses three families of DAQ hardware:

  • PCIe X Series (NI 63xx)
  • PCI M Series (NI 62xx)
  • USB M Series (NI 621x)
Uses one or two X Series devices to acquire analog data.
DriversDrivers
  • NI-MHDDK 2.0 for PCIe X Series support
  • NI-DAQmx 8.0.2 for PCI M Series support
  • NI-DAQmx Base 3.6 for USB M Series support
  • NI-MHDDK 2.0 for PCIe X Series support
Setting up the demoSetting up the demo
  1. Install LabVIEW (see its readme)
  2. Install the DAQ drivers
    1. NI-DAQmx 8.0.2 first (see its readme)
      • Manually add support for LabVIEW 2012 by selecting to install LabVIEW 8.6 support (under the default path) and by following these instructions.
    2. NI-DAQmx Base 3.6 second (see its readme)
  3. Build the X Series DDK shared library using the NI-VISA OS interface component (see below)
  1. Install LabVIEW (see its readme)
  2. Build the X Series DDK shared library using any Linux OS interface component (see below)
Running the demoRunning the demo
  1. Open "LinuxDAQDriverDemo.vi".
  2. Connect the devices together using the diagram on the "System" tab.
  3. Connect a 10 kHz 0 - 5 V square wave to PFI0 of the PCI M Series device.
  4. Under the "Configuration" tab, specify your devices names.
    • Use the "lsdaq" command to identify your USB M Series device.
    • Use the dropdown box or the "nilsdev" command to identify your PCI M Series device.
    • Use the dropdown box or the "NIvisaic" command to identify your PCIe X Series device.
  5. Switch to the "Data" tab.
  6. Run the VI.
  1. Open "NIXSeriesLabVIEW.lvproj".
  2. Connect an input signal to ai0 of your X Series device(s).
  3. If you have one X Series device, open "OneDevice.vi".
  4. If you have two X Series devices, open "TwoDevicesXYPlot.vi".
  5. Specify your device(s) bus and device numbers.
    • If you're using the NI-VISA OS interface component, use the "NIvisaic" command to determine them.
    • If you're using the Linux kernel OS interface component, use the "lsdaq" command to determine them.
  6. Run the VI.
DownloadsDownloads

Building the X Series DDK as a Shared Library
  1. Update the make rules and targets to build a shared library.
    1. OS Interface makefile (eg linux-visa.mak)
      1. Define "DLL_SUFFIX := .so" after "PRG_SUFFIX".
      2. Add "--export-dynamic -shared" to "LDFLAGS".
      3. Replace "$(PRG_SUFFIX)" with "$(DLL_SUFFIX)".
    2. Makefile
      1. Set "OSINTERFACE_MAKEFILE" to your OS interface component.
      2. Update "USE_64_BIT" to match your kernel's bitness.
      3. Remove "$(BUILD_DIR)/main$(OBJ_SUFFIX)" from the "OBJECTS" list.
      4. Replace all of the targets listed under "TARGETS" with "$(BUILD_DIR)/main$(DLL_SUFFIX)".
      5. Replace the "ifneq" block with "include $(DMA_LIBRARY_DIR)/dma.mak".
    3. Update main.cpp to expose aiex3 as a shared library.
      • Place the patch file (attached) in the same folder as the "nixseries" folder and apply it by typing:
        • $ patch nixseries/Examples/main.cpp < makeSharedLibary.patch
  2. Build the shared object by typing:
        • $ cd nixseries
        • $ make
    1. If using NI-VISA, allow NI-VISA to associate with X Series devices by following the Linux directions in "nimhddk_visa.inf".
    2. If using the Linux kernel module, insert the nirlpk.ko module into the kernel (see its readme).
    3. Install the new shared library by typing as root:
        • # cp main.so /usr/local/lib/libnixseriesddk.so
        • # ldconfig
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 1 of 1
(8,235 Views)