FrustratedwithDAQmxHelp
2007-09-25 14:40:15 UTC
Hi Guys, I need to generate a large buffer for pattern generation and do not want to duplicate the memory requires. It seems to me if I use:DAQmxWriteDigitalU16(OutTaskHandle,OutBufPnt,0,0,DAQmx_Val_GroupByChannel,OutBuf,NULL,NULL)I have to allocate space for the buffer OutBuf (in this case), write my vectors to this buffer and then DAQmx will duplicate this buffer and copy it to another memory space, thus require two large buffers (which I do not have enough memory for). 1. Can I not just create the DAQmx buffer and write to it directly?2. If so how do I do this?My second part of this question is that I also need to alter some of the vectors in my buffer, recopy this vector buffer to DAQmx buffer and the rerun the entire set. I do this in the loop shown below: for (count1=0;count1<TotalSequencesInAquisition;count1++) {/* Load vector buffer with correct DAC codes */
InsertDACCodeToConvVectors(DACBuf,OutBuf,DACPointer,DACCodesPerSequence,count1);
/* DAQmx Start Pattern Generation */ DAQmxErrChk (DAQmxWriteDigitalU16(OutTaskHandle,OutBufPnt,0,0,DAQmx_Val_GroupByChannel,OutBuf,NULL,NULL)); DAQmxErrChk (DAQmxStartTask(InTaskHandle)); DAQmxErrChk (DAQmxStartTask(OutTaskHandle)); DAQmxErrChk (DAQmxWaitUntilTaskDone(InTaskHandle,10)); DAQmxErrChk
(DAQmxReadDigitalU16(InTaskHandle,DataPerSequence,0,DAQmx_Val_GroupByChannel,&DataBuf[DataPerSequence*count1],DataPerSequence,NULL,NULL)); DAQmxErrChk (DAQmxWaitUntilTaskDone(OutTaskHandle,10)); DAQmxErrChk (DAQmxStopTask(InTaskHandle)); DAQmxErrChk (DAQmxStopTask(OutTaskHandle)); }The issue is that this runs correctly the first time through but the second time it does not seem that the updated OutBuf buffer is being copied to the DAQmx buffer and the first set of vectors are simply rerun. 1. What am I doing wrong?I suppose if my first question is answered then the second is probably not relevant. However, I still am a little baffled as to why this does not work.Thanks
InsertDACCodeToConvVectors(DACBuf,OutBuf,DACPointer,DACCodesPerSequence,count1);
/* DAQmx Start Pattern Generation */ DAQmxErrChk (DAQmxWriteDigitalU16(OutTaskHandle,OutBufPnt,0,0,DAQmx_Val_GroupByChannel,OutBuf,NULL,NULL)); DAQmxErrChk (DAQmxStartTask(InTaskHandle)); DAQmxErrChk (DAQmxStartTask(OutTaskHandle)); DAQmxErrChk (DAQmxWaitUntilTaskDone(InTaskHandle,10)); DAQmxErrChk
(DAQmxReadDigitalU16(InTaskHandle,DataPerSequence,0,DAQmx_Val_GroupByChannel,&DataBuf[DataPerSequence*count1],DataPerSequence,NULL,NULL)); DAQmxErrChk (DAQmxWaitUntilTaskDone(OutTaskHandle,10)); DAQmxErrChk (DAQmxStopTask(InTaskHandle)); DAQmxErrChk (DAQmxStopTask(OutTaskHandle)); }The issue is that this runs correctly the first time through but the second time it does not seem that the updated OutBuf buffer is being copied to the DAQmx buffer and the first set of vectors are simply rerun. 1. What am I doing wrong?I suppose if my first question is answered then the second is probably not relevant. However, I still am a little baffled as to why this does not work.Thanks