07-05-2010 03:24 PM
I have a PCIe6537, My output is using external clock and I would like to stuff the write buffer as much as I can. Using the DAQmxGetWriteSpaceAvail() always returns 0??? Using DAQmxRegisterDoneEvent() is too slow and too late to refill the output-buffer; clock are missed.
The following is my code:
DAQmxErrChk (DAQmxCreateTask("Out",&taskOut));
DAQmxErrChk (DAQmxCreateDOChan(taskOut,"Dev1/port2_16","",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskOut,"PFI4",1200000,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,255));
DAQmxErrChk (DAQmxWriteDigitalU16(taskOut,BUFFSIZE,0,timeout,DAQmx_Val_GroupByChannel,dataOut,NULL,NULL));
DAQmxErrChk (DAQmxStartTask(taskOut));
DAQmxGetWriteSpaceAvail(taskOut,&room);
printf(
"roomm=%d",room);07-05-2010 04:40 PM
Also need a way to refill the output buffer without stopping and restarting the task.
07-09-2010 03:55 PM
Hi Norman,
It looks like you have a finite task configured; are you trying to generate continuously? Can you an example like ContWriteDigPort_ExtClk ? You can find that program in …National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Generate Values.
07-09-2010 04:03 PM
The reason for using "Finite" because I have a 2GB file, that I have previously recorded, which I would need to playback. I don't believe PXIe-6537 allows me to "write" the entire file to the task.
07-12-2010 06:38 PM
Howdy Norman!
Even though your file is finite, since it is so large you will need to write it to the PCIe-6537 in chunks by using a loop similar to the continuous acquisition examples.
Regards,
07-13-2010 07:35 AM
Using the "Cont Read Dig Chan-Ext Clk" example, it reads a chunk of data, wait until it is completed, and read another chunk of data.
However, my output is driven by a 12MHz EXTERNAL clock, I will miss some clock pulses if I "write", "wait for done" before "write" again (a dozen of clocks will pass between the done event and my "write" in the callback). Missing a few clock pulses means inserting undesired idle period. To playback the same way as I recorded the samples, I will need to refill the output buffer before the buffer is empty out.
So, I need to start-off writing a chunk of data to the buffer, and I need to continuously top up the output buffer again before it is empty.
07-14-2010 01:33 PM
Hi Norman,
Is your task configured to use regeneration mode? If so that could be preventing the buffer from freeing up space after samples are generated. Disabling regeneration should allow you to use the DAQmxGetWriteSpaceAvail function.
Regards,