Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Error using DAQmxCfgDigEdgeStartTrig

I did not mean that.

I was saying that I could not reat out 1,000,000 samples at once if they where uInt32 because I can not allocate so much memory.

Instead, I configured my task to sample 1,000,000 samples, but read it in chunks four times. In this case I have to allocate only a quater of the required memory. Thus, I rely on the belief that when I call the read function first time, I read samples 1 through 250000, when I call it the second time I read samples 250001 through 500000, and so on. So my question was if my assumption is correct and whether thescript below will do what I need:

DAQmxErrChk(DAQmxCreateTask("",&samplHandle));
DAQmxErrChk(DAQmxCreateDIChan(samplHandle,"Dev1/port0/line0:7","",DAQmx_Val_ChanForAllLines));
DAQmxErrChk(DAQmxCfgSampClkTiming(samplHandle,"/Dev1/PFI0",1000000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000000));
DAQmxErrChk(DAQmxRegisterEveryNSamplesEvent(samplHandle,DAQmx_Val_Acquired_Into_Buffer,1000000,0,Callback,this));
DAQmxErrChk(DAQmxTaskControl(samplHandle,DAQmx_Val_Task_Commit));
DAQmxErrChk(DAQmxCfgInputBuffer(samplHandle,1000000));

Then I start the task and hope that it will sample my signal based on the sample clock signal without calling 'read' function. When all 1,000,000 samples are sampled, the NSamplesEvent calls callback function in which I perform first read:

DAQmxErrChk(DAQmxReadDigitalU32(samplHandle,250000,10.0,DAQmx_Val_GroupByChannel,ddata,250000,&numRead,NULL));

Then I copy and convert first 2500000 samples from ddata to my large 1,000,000 uInt8 array. Then I call the read function again and copy a second set of data into my large array. I do this four times to get all 1,000,000 samples.

The reason I am asking is that I can not check if it works properly at this point. I do not have a digital signal generator to assess the performance. So, I wanted to know if my script is properly written to perform the task. Then, I plan to hook up the ADC conveter (which also has to be configured out). Knowing that my aquisition system working properly, I will blame everything on the ADC circuit. Otherwise, I will not know if the problem is in NIDAQ or the ADC converter. Also, with this task configuration, do you think I could sample around 10MHz? I know that's the limit, but I wish to get as close as possible to that.

0 Kudos
Message 11 of 13
(1,486 Views)

Naz,

 

Sorry for the misunderstanding. There is an input for DAQmxReadDigitalU32 for numSampsPerChan, you can use this to determine how many samples are read when the function is called. This way you could acquire the a set number of samples. Reference the NI-DAQmx C Reference help for further details on the function.

Aaron W.
National Instruments
CLA, CTA and CPI
Message 12 of 13
(1,483 Views)

Aaron,

I think I've got it all figured out. Only the last part is to try it at 10MHz sampling clock.

Thank you very much for your help.

0 Kudos
Message 13 of 13
(1,481 Views)