Discussion:
DAQmxStopTask Crash
(too old to reply)
Jono
2006-10-06 12:40:10 UTC
Permalink
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
 
exits loop
 
printf("stoping task ...\n");
DAQmxStopTask(taskhandle) //CRASHES HERE
Help!!!
jcarbonell
2006-10-08 15:40:07 UTC
Permalink
Jono wrote:
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
 
exits loop
 
printf("stoping task ...\n");
DAQmxStopTask(taskhandle) //CRASHES HERE
Help!!!Hi Jono,To help you out, I need more information.  In particular, what are you doing with the board?  Which timing type are you using (DAQmxCfgSampClkTiming?)? Which physical channels are in the task (What are your parameters to DAQmxCreateDIChan?) ? What properties are you configuring?   Which operating system are you using? What do you mean by crash: is the computer rebooting on its own or blue-screening, is your application hanging?
Jono
2006-10-09 08:40:10 UTC
Permalink
Hi jcarbonell
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;
}
Jono
2006-10-10 09:10:08 UTC
Permalink
Hi Sarah
 
Thankyou for posting I have lowed the sample to one and the system still seems to hang
 
Regards
 
Jonathan Smith

Loading...