Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to structure the DMA buffer for PXie 6341 DAQ card for analog output with different frequencies on each channel

Solved!
Go to solution

I'm using the MHDDK for analog out/in with the PXIe 6341 DAQ card.

 

The examples, e.g. aoex5, show a single Timer  (outTimerHelper::loadUI method), but the example shows DMA data loaded with the same vector size.

 

There is a comment in the outTimerHelper::programUpdateCount call which implies that different buffer sizes per channel can be used.

   (the comment is: Switching between different buffer sizes will not be used)

 

Does anyone know what the format of the DMA buffer should be for data for multiple channels with different frequencies ?

 

For example, say we want a0 with a 1Khz Sine wave and a1 with a 1.5Khz sine wave.  What does the DMA buffer look like ?

 

With the same frequency for each channel, the data is interleaved, e.g.  (ao0#0, ao1#0; ao0#1, ao1#1, ...), but when the frequencies for each channel is different, what does the buffer look like ?

 

0 Kudos
Message 1 of 2
(8,232 Views)
Solution
Accepted by topic author kenstern

Hello Kenstern,

 

The data is always interleaved because each card only has a single timing engine for each subsystem.

 

For AO you must specify the number of samples that AO will output. You also specify the number of channels. Because there is only one timing engine for AO, each AO will channel will get updated at the same time tick of the update clock. The data will be arranged interleaved exactly as the example shows because each AO channel needs data to output at each tick of the update clock. The data itself can change based on the frequency you want to output.

 


@kenstern wrote:

For example, say we want a0 with a 1Khz Sine wave and a1 with a 1.5Khz sine wave.  What does the DMA buffer look like ?

 

With the same frequency for each channel, the data is interleaved, e.g.  (ao0#0, ao1#0; ao0#1, ao1#1, ...), but when the frequencies for each channel is different, what does the buffer look like ?

 


 

In your example, you need to come up with an update rate that works for both waveforms (1 KHz and 1.5 KHz sine waves). To get a good representation of a sine wave, you need to update more than 10x as fast as your fastest frequency...I would recommend 100x if possible.

 

Update Frequency: 150 KHz

Channels: 2

 

Then you create buffers that include full cycles of each waveform you want to output based on the update frequency. These buffers must also be the same size.

 

Buffer 1: Contains data for the 1 KHz sine wave, 300 points, 2 sine wave cycles

Buffer 2: Contains data for the 1.5 KHz sine wave, 300 points, 3 sine wave cycles

 

You then interleave them as before. When the data is run through the ADC, they are outputting different sine waves even though the AO channels are updating at the same rate.

0 Kudos
Message 2 of 2
(8,221 Views)