Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

What does DAQ_Check check exactly?

In DAQ manual, DAQ_Check is all about pretrigger operation. We have a radar device collecting analog signal between each pretrigger. 

 

For DAQ_Check replacement for DAQmx, DAQmxIsTaskDone or DAQmxGetTaskComplete also returns a boolean value to determine whether the task is completed. But my operations is for infinite sampling until user clicks an interface button. How can I know my sample is being gathering between each pretrigger? I also tried to use Callback function for each N sample is collected, but I'm not sure how to manipulate it well.

 

Even if I may check return value of DAQmxIsTaskDone or DAQmxGetTaskComplete, it may not return the right value, for DAQ_Check is all about pretrigger but DAQmx function checks whether the target function is done or not. I wonder I have to use DAQmxGetTaskComplete function but it just looks the task handler, so new function DAQmxGetTaskComplete won't return the right boolean value until AI operation is done. 

 

If I use a different task handler on DAQmxExportSignal function, I wonder DAQmxGetTaskComplete can look up that task handler and I may be able to determine pretrigger is done just like DAQ_Check function.

 


I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 1 of 4
(3,351 Views)

Here is the old code with DAQ_Check

---------------------------------------------

... 

unsigned long number = 0 

 

while( done != 1) 

{   

  status = DAQ_Check( 1, &done, &number );       

   ptr->bRadarTrigger = FALSE; 

   ...

 

  if( ptr->bAbortAcquire ) 

done = 1;


}

 

}  

 

New code scanning operation

---------------------------------- 

{

... 

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

DAQmxErrChk (DAQmxExportSignal(SCAN_Handle, DAQmx_Val_StartTrigger, "/Dev1/PFI0" )); //pretrigger source is PFI0 in PCI-6025E

DAQmxErrChk (DAQmxSetAIGain(SCAN_Handle, "Dev1/ai0", gainValue));

DAQmxErrChk (DAQmxSetAIConvTimebaseDiv(SCAN_Handle, 500));

DAQmxErrChk (DAQmxSetSampClkTimebaseDiv(SCAN_Handle, 2000));

DAQmxErrChk (DAQmxCfgSampClkTiming(SCAN_Handle,"",samplePerChanPerSec,DAQmx_Val_Rising,DAQmx_Val_ContSamps,sampleCounts));

DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(SCAN_Handle,DAQmx_Val_Acquired_Into_Buffer,1000,0,EveryNSamplesCallback,NULL));

... 

 }

 

int32 CVICALLBACK EveryNSamplesCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)

{

int32 error=0;

int32 read;

static float64 data[1000];

DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,-1,10.0,DAQmx_Val_GroupByScanNumber,data,1000,&read,NULL));

 

...


Message Edited by anarkie on 06-11-2009 01:58 PM
I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 2 of 4
(3,350 Views)

This is from DAQ manual:

DAQ_Check

status = DAQ_Check (deviceNumber, daqStopped, retrieved) 

 

"..However, if pretrigger mode is enabled, retrieved returns the offset of the position in your buffer where the next data point is placed when it is acquired..."

 

So, I used this function like this:  Check_Daq( ptr, ptr->iTotalSize ); 

 

iTotalSize is the expected sample total size. How can I count this size with DAQmxIsTaskDone or DAQmxGetTaskComplete?

Message Edited by anarkie on 06-11-2009 03:29 PM
I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 3 of 4
(3,340 Views)

Anarkie,

 

Thank you for using the NI Forums. I was able to look around in the DAQmx C Reference Help, and I believe the function you are looking for is under, NI-DAQmx C Properties » List of Read Properties » Status » Total Samples Per Channel Acquired. The description of the function is: Indicates the total number of samples acquired by each channel. NI-DAQmx returns a single value because this value is the same for all channels. This seems to be similar to what you are looking for. Hope this helps. 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 4 of 4
(3,321 Views)