Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxStopTask() for an input sampling task crashes.

When running a digital output task of more than 2048 samples concurrent with a finite sample input task, calling DAQmxStopTask() on the input task locks up the computer to where it needs to be reboot.  I have set use onboard memory to false in the digital output task.  Does anyone know of any problems with using more than 2049 samples in digital output mode?

0 Kudos
Message 1 of 7
(3,898 Views)
Sorry I forgot to mention that this is on a PCI-6115.  I can run the EXACT same program on a PXI-6115 and everything runs fine.
0 Kudos
Message 2 of 7
(3,883 Views)
Hello TimBe,

Just to make sure I completely understand your application, it sounds like you are running a correlated digital output task synchronized to an analog input task.  In this case, you would be acquiring the same number of analog samples as the number of digital samples that you are generating.  Is this correct?  If so, what rate are you acquiring at? 

Also, do you have the same version of NI-DAQmx on both your PC and your PXI controller (if you are using one)?  You can check what version you have installed by expanding the Software category in MAX and clicking on NI-DAQmx. 

Some further description of the behavior you are seeing would also be helpful.  For example, do the tasks complete with no errors before you reach the DAQmxStopTask( ) function? 

Finally, can you post a simplified version of your code that only includes the functionality necessary to demonstrate this behavior?  If I can reproduce what you are seeing, we can investigate the issue further. 

Best regards,
0 Kudos
Message 3 of 7
(3,874 Views)

Im having what sound to be the same problem with my NI PCI-32HS card im going around the loop 1000 sampling once each time reading from PORT's 0 and 1 with contoius sampling and interleving of data have not got the foggest what causing it

Help!!!

0 Kudos
Message 4 of 7
(3,814 Views)
Hello Jono,

Some further description of your application would be very helpful.  Please consider the following questions.

1.  First of all, which programming environment are you using for your application?  LabWindows/CVI?  C?  LabVIEW?  I am assuming (based on the thread title) you are using either CVI or another ANSI C compiler.

2  What type of digital input task are you programming?  It could be hardware-timed or software-timed.  If it is hardware-timed digital input, what kind of sample timing are you using?  Is it sample clock timing, or change detection, or handshaking?  If you can tell me exactly what type of task you need, perhaps I can't point you to a relevant example program.

3.  Are any errors occuring before the DAQmxStopTask() function?  Please ensure that you are handling errors with the DAQmxErrChk() function.

With the answers to these questions, hopefully we can gain further insight into the source of the problem.  If you have any other helpful information, please feel free to include that as well.  With more information, I will be glad to help you troubleshoot further!

Best regards,
0 Kudos
Message 5 of 7
(3,797 Views)

Hi Jarrod

Thankyou for giving me hand

I have put a copy of my example code here I am using PCI-DIOHS card under linux

(I am using a altered verison the Red Hat Installation under Slackware 10.2)

by a crash I mean that the appilcation is hanging and I need to reboot before I can use the DIO Card again

Many Thanks

Jonathan Smith

 

#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;

uInt32 data[1000];

int32 sampsRead,totalRead;

char errBuff[2048]={'\0'};

/*********************************************/

// DAQmx Configure Code

/*********************************************/

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

DAQmxErrChk (DAQmxCreateDIChan(taskHandle,"Dev1/port0,Dev1/port1","",DAQmx_Val_ChanForAllLines));

DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/PFI6",10000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,10000));

/*********************************************/

// DAQmx Start Code

/*********************************************/

DAQmxErrChk (DAQmxStartTask(taskHandle));

/*********************************************/

// DAQmx Read Code

/*********************************************/

printf("Acquiring samples continuously. Press Ctrl+C to interrupt\n");

printf("TaskHandle %d\n",taskHandle);

while( totalRead< 1000 ) {

/*********************************************/

// DAQmx Read Code

/*********************************************/

DAQmxErrChk (DAQmxReadDigitalU32(taskHandle,1,10.0,DAQmx_Val_GroupByScanNumber,data,1,&sampsRead,NULL));

if( sampsRead>0 ) {

totalRead += sampsRead;

printf("Acquired %d samples. Total %d\r",sampsRead,totalRead);

fflush(stdout);

}

}

printf("\n Stopped has Acquired %d total samples.\n",totalRead);

printf("TaskHandle %d\n",taskHandle);

if( taskHandle!=0 ) {

/*********************************************/

// DAQmx Stop Code

/*********************************************/

printf("stoping task ...\n");

DAQmxErrChk (DAQmxStopTask(taskHandle));

printf("is clearing up task ...\n");

DAQmxErrChk (DAQmxClearTask(taskHandle));

}

printf("exiting ...\n");

exit(0);

return 0;

Error:

if( DAQmxFailed(error) )

DAQmxGetExtendedErrorInfo(errBuff,2048);

if( DAQmxFailed(error) )

printf("DAQmx Error: %s\n",errBuff);

printf("End of program, press Enter key to quit\n");

getchar();

return 0;

}

0 Kudos
Message 6 of 7
(3,775 Views)
Hello Jono,

One thing that stands out is your mention of using an "altered" version of Red Hat Linux.  The NI-DAQmx 8.0 driver for Linux only supports three distributions, one of those being Red Hat Enterprise Linux WS 3.  If you are not using this exact version, we cannot guarantee that everything will work properly. 

There are a couple of things I would suggest in terms of programming this application.  First of all, you've configured this to be a continuous task, but you are trying to read 1000 samples every time.  With this in mind, I would setup a finite acquisition instead of continuous.  This can be done by replacing the "DAQmx_Val_ContSamps" parameter in the DAQmxCfgSampClkTiming() function with "DAQmx_Val_FiniteSamps".  Secondly, instead of calling DAQmxReadDigitalU32() once for every sample, call it fewer times, acquiring more points per call. 

Finally, I would suggest that you try running one of the digital example programs located under /usr/local/natinst/nidaqmx/examples/ansi_c/.  If the example programs work, then use them as a template for your development. 

I hope this helps!

Best regards,
0 Kudos
Message 7 of 7
(3,754 Views)