Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQ on Ubuntu 18.04

I have a NIDAQ 6221 board and I am trying to install NI drivers on my ubuntu 18.04 system. I am trying to install as per the website here: https://www.ni.com/en-us/support/documentation/supplemental/18/downloading-and-installing-ni-driver-...

 

The installation has completed with no error. I am trying to run the following script:

 

#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else

int main(void)
{
       int32       error=0;
       TaskHandle  taskHandle=0;
       int32       read;
       float64     data[1000];
       char        errBuff[2048]={'\0'};

// DAQmx analog voltage channel and timing parameters

DAQmxErrChk (DAQmxCreateTask("", &taskHandle));

DAQmxErrChk(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL));

DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle, "", 10000.0, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 1000));

// DAQmx Start Code

DAQmxErrChk(DAQmxStartTask(taskHandle));

// DAQmx Read Code

DAQmxErrChk(DAQmxReadAnalogF64(taskHandle, 1000, 10.0, DAQmx_Val_GroupByChannel, data, 1000, &read, NULL));

// Stop and clear task

Error:
       if( DAQmxFailed(error) )
             DAQmxGetExtendedErrorInfo(errBuff,2048);
       if( taskHandle!=0 )  {
              DAQmxStopTask(taskHandle);
              DAQmxClearTask(taskHandle);
       }
       if( DAQmxFailed(error) )
              printf("DAQmx Error: %s\n",errBuff);
              return 0;
}

 

I can make the file successfully. But while running the script, it is throwing out the following error.

 

libnipalu.so failed to initialize
Verify that nipalk.ko is built and loaded.
Aborted (core dumped)

 

It will be a great help if anyone can guide me on what to do. Thanks!

 

 

0 Kudos
Message 1 of 2
(158 Views)

I am using NIDAQ-6211. Sorry for the mistake. 

0 Kudos
Message 2 of 2
(127 Views)