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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Output several waveforms on DAQ6731

Hello,

I am trying to program a DAQ6731 to simultaneously output different analog signals at separate channels. I am using Microsoft Visual C++ and shaping my code after the AO Examples that came with the package. First, my program reads in number data in f64 (double) format. It puts the data points into dynamic arrays (buffers). Then it passes these buffers to WFM_Scale. Then I use the series of WFM_Group_Setup, WFM_Load, WFM_Rate, WFM_ClockRate, and WFM_Group_Control/START to begin outputting the analog signals.

My problem is that I can't figure out how to output more than one signal at the same time. I call WFM_Load several times, once for each waveform (and each one goes to a different channel). When I run t
he program, it seems like the last call to WFM_Load supercedes and cancels out all previous calls. At first, I put all channels in the same Group, Group 1.

I noticed in the Traditional NI-DAQ Function Reference Help Version 7.1, in the description of WFM_Load, it says that "for 673X devices, you cannot load multiple buffers for a single group." So I tried to create several Groups, one for each waveform I wanted. But this generates errors in the program which say that I've used invalid Group numbers.

What is the correct way to program the DAQ6731 so that it will output different analog waveforms at different channels, all at the same time?
0 Kudos
Message 1 of 2
(2,242 Views)
Art,

To simultaneously output on multiple analog output channels, you will need to generate a single buffer with interleaved channel data. For example, the following section of code creates piBuffer by interleaving piBuffer0 and piBuffer1. Thus, the data for two analog output channels is interleaved into a single buffer that can be loaded with the WFM_Load function.

for (i=0;i<ulCount;i++)
{
piBuffer[2*i]=piBuffer0[i];
piBuffer[2*i+1]=piBuffer1[i];
}

The only other difference between a single-channel and multi-channel analog output application is the correct specification of the numChans and chanVect parameters of the WFM_Group_Setup function.

Good luck with your application.

Spencer S.
Message 2 of 2
(2,242 Views)