Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxStopTask Crash

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!!!

0 Kudos
Message 1 of 8
(4,378 Views)


@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?


0 Kudos
Message 2 of 8
(4,362 Views)

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;

}

0 Kudos
Message 3 of 8
(4,352 Views)
Hi Jono,

I may have misunderstood your post but are you reading 1 sample per iteration? From reading your code, it appears that you have configured the measurement to acquire 1000 samples for each iteration but you're only reading/extracting one 1 sample from the buffer for each iteration.

You're not reading the data fast enough and that's probably what's causing your system to hang. If you only need one sample, reduce the number of samples to acquire.

Regards,

Sarah

Applications Engineer | National Instruments | UK & Ireland
0 Kudos
Message 4 of 8
(4,342 Views)
Hi Sarah
 
Thankyou for posting I have lowed the sample to one and the system still seems to hang
 
Regards
 
Jonathan Smith
0 Kudos
Message 5 of 8
(4,332 Views)
Hi Jonathan,

What do you mean still "seems" to hang? Is it behaving the same as before? Do you get an error code? Does it log data and then hang or does it never work? Have you tried different settings in your program? Try playing around with the number of samples and the sample rate to see if that makes a difference.

Have you tried any of the example code that ships with DAQmx? Do they work?
Sarah

Applications Engineer | National Instruments | UK & Ireland
0 Kudos
Message 6 of 8
(4,329 Views)

Sarah

I have tired the example with DAQmx which all exbit the same behave as the my in example I meen by it hanging that it get to the DAQStopmx Task and stop completely it does not generate and error just a white block appear on shell screen and you can't Crtl+C to escape It will tried having a paly with the setting woul;d updating the kernel help ?

Many Thanks

 

Jonathan Smith

0 Kudos
Message 7 of 8
(4,327 Views)
Hi Jonathan,

The fact that the example code isn't working either could indicate a compatibility issue with DAQmx and the OS you're using. I did find a discussion forum where a user posted a description on how to install DAQmx on a Slacker 10.2 Linux system. It would be worth going through that to make DAQmx was installed correctly:
http://forums.ni.com/ni/board/message?board.id=170&message.id=162846&requireLogin=False

Quoting the readme for DAQmx 8.0:

"Operating System Support
------------------------
NI-DAQmx 8.0 for Linux software for the Intel x86 32-bit architecture is
supported on the following Linux distributions:

* Mandrakelinux 10.1 Official and Mandriva Linux 2006
* SUSE LINUX Professional 9.2 and 9.3
* Red Hat Enterprise Linux WS 3

Red Hat Enterprise Linux WS 4 is not supported in this release. However, if your
situation requires Red Hat Enterprise Linux WS 4, a KnowledgeBase entry exists
to provide guidance. For more information, refer to ni.com/info. Enter the info
code "rh4bld" and click "Submit."

For more information about the Linux distributions and versions that National
Instruments supports, refer to ni.com/linux.
"

Do you have access to Red Hat Enterprise Linux WS 3?

Message Edited by SarahB on 10-10-2006 05:55 AM

Sarah

Applications Engineer | National Instruments | UK & Ireland
0 Kudos
Message 8 of 8
(4,324 Views)