From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Feedback on NI Community

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you output different waveforms on 2 channels with circular buffers?

I'm trying to program the PCI-6711 to output two different complex waveforms on DAC0OUT and DAC1OUT using Visual Basic. I'm working from the VBasic WFMdoubleBuf example by expanding the number of channels and the ChanVect to the two channels and loading and transfering to two different channels. I am filling the initial buffers by inputing data from a file But instead of seeing separate but synchronized waveforms on the two channels, I'm seeing no waveform on DAC0OUT, and a combination of the two waveforms on DAC1OUT. What am I doing wrong?
0 Kudos
Message 1 of 3
(4,014 Views)
Roz,
I think you posted this in the wrong category. I don't believe that anyone in the community or any Applications Engineers that could assist you browse through this category very often. You may want to repost your question in one of the Measurement Hardware categories.

Thanks,
Daniel McChane
Discussion Forum Administrator
National Instruments
0 Kudos
Message 2 of 3
(4,014 Views)
Roz,

Calling the WFM_Load() function multiple times for multiple channels is useful only if you are not doing double buffering. When you do double buffering, the WFM_DB_Transfer() function requires that the two waveforms be interleaved. The KnowledgeBase linked below discusses this in more detail:

Waveform Generation on Multiple Channels Using PCI E Series Boards

Furthermore, I have included a code snippet that illustrates the process of interleaving the waveforms, etc.

------------------------------------------------------
iStatus = NIDAQMakeBuffer(pdBuffer0, ulCount, WFM_DATA_F64);

iStatus = NIDAQMakeBuffer(pdBuffer1, ulCount, WFM_DATA_I16);

if (iStatus == 0) {


/* If buffer was made correctly, then output it. */

iStatus = WFM_DB_Config(iDevice, iNumChans, piChanVect,
iDBmodeON, iOldDataStop, iPartialTransferStop);

iRetVal = NIDAQErrorHandler(iStatus, "WFM_DB_Config",
iIgnoreWarning);

iStatus = WFM_Group_Setup(iDevice, iNumChans, piChanVect,iGroup);

iRetVal = NIDAQErrorHandler(iStatus, "WFM_Group_Setup",
iIgnoreWarning);

iStatus = WFM_Scale(iDevice, piChanVect[0], ulCount, 1.0, pdBuffer0,piBuffer0);

iRetVal = NIDAQErrorHandler(iStatus, "WFM_Scale",
iIgnoreWarning);

/****************INTERLEAVING OPERATION**************************/
/*For analog output on multiple channels, the data should be interleavedbefore outputting.*/

for (i=0;i{
piBuffer[2*i]=piBuffer0[i];
piBuffer[2*i+1]=piBuffer1[i];
}
/****************INTERLEAVING OPERATION**************************/

iStatus = WFM_Load(iDevice, iNumChans, piChanVect, piBuffer,ulCountTotal, ulIterations, iFIFOMode);

iRetVal = NIDAQErrorHandler(iStatus, "WFM_Load",
iIgnoreWarning);

iStatus = WFM_Rate(dUpdateRate, iUnits, &iUpdateTB,
&ulUpdateInt);

iRetVal = NIDAQErrorHandler(iStatus, "WFM_Rate",
iIgnoreWarning);

iStatus = WFM_ClockRate(iDevice, iGroup, iWhichClock,
iUpdateTB, ulUpdateInt, iDelayMode);

iRetVal = NIDAQErrorHandler(iStatus, "WFM_ClockRate",
iIgnoreWarning);

printf(" The waveform should be output at a rate of %lf updates/sec.\n", dUpdateRate);

iStatus = WFM_Group_Control(iDevice, iGroup, iOpSTART);

iRetVal = NIDAQErrorHandler(iStatus,
"WFM_Group_Control/START", iIgnoreWarning);
------------------------------------------------------

Good luck with your application.

Spencer S.
0 Kudos
Message 3 of 3
(4,014 Views)