Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Multichannel External Triggered Analog Output

I am using Nidaq 6.9.2 with C  (Borland C++ Builder 5).
 
I am trying to output waveforms on two AO channels while simultaneosly reading two Analog inputs.
I have set ND_OUTPUT_UPDATE to PFI_5 , my external update trigger source.  This trigger source is also connected to the Gate of Ctr0  to generate a delayed pulse (using retriggerable pulse application) to trigger an anlog input scan across the input channels.
 
This works great for 1 output and a single or multiple input channels.
 
When I try two outputs I can't seem to get the output data buffer values to appear on the outputs. The buffer array has the output values for both outputs interleaved ( just like the input buffer values will be).
Looking at the input data it seems the output data is all being sent to AO_0 while AO_1 is idle.  The output waveform never completes as it only gets halfway through the data before the input Scan gets all its readings done.
 
The buffer is only a   short *  (i16*), so the outputs must be interleaved, right?  (Not two separate array's or two concatenated arrays, right?)
 
I use WFM_ClockRate( iDevice=1, whichclock=0, timebase=0, interval=0, mode=0) as part of the setup for the scan.
Are the DAC's all updated simultaneously on receiving the udate (PFI_5) signal?  What controls the triggering of the individual output channels? The SCAN function for input has a sample ( data point to data point) and a scan ( sweep across channels) timebase.
 
I've had good luck with getting Nidaq to do what I want so far. Hope I can get help to solve this.
 
Thanks
 
Dave
 
0 Kudos
Message 1 of 2
(2,966 Views)
Dave,

How exactly are you performing your analog output? I'm guessing that the problem is not with the triggering, but rather the buffer setup. A simplified version of your code may be helpful here. As an example, I would start with the WFMsingleBufRegenerate.C shipping example available here:

C:\Program Files\National Instruments\NI-DAQ\Examples\VisualC\Ao\

In this example, the WFM_Op assigns a waveform output buffer to an analog output channel. This can be extended to multiple channels by increasing the size of piChanVect and piBuffer and increasing iNumChans to reflect this change. The data in piBuffer should be interleaved, as you are currently doing. Please let me know if these modifications do not work out for you.

Hope this helps,

Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 2 of 2
(2,960 Views)