Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous, hardware timed, dual channel analogue output query

Hello,

I wish to output separate waveforms to the two analogue output channels on an M-Series PCIe-6251, but I need to be able to change one of the waves 'on the fly', so to speak, without disrupting the wave on the other channel.

To give a little more detail, I have currently set up a continuous, hardware timed, dual channel analogue output using the MHDDK examples as a basis. I have a special thread in my program that cycles regularly in order to fill up the board's AO FIFO so that it never runs out of samples. At the moment, if the analogue output in my program is turned 'off', the thread simply outputs zero values to the FIFO. When I want to switch the output 'on', I send a message to clear the zero values from the FIFO, and then begin filling it up with the new samples, which works great when I'm only using one channel, or when both channels should start and stop at the same time.

The problem arises when I want to start outputting to the second channel when the first channel is already 'on'. As an example, at the point where I want to start transmitting data on the second channel, there might be 1s of uncleared samples in the FIFO, i.e. an interleaved combination of part of a waveform on the first channel, and zeros representing no signal on the second channel.

Ideally, I want to be able to replace those zeros for the second channel with the start of my new waveform, and without disrupting the waveform already committed to the first channel. Obviously, this by definition is not how a FIFO works, but I was wondering if there is any functionality relating to the FIFO that would help me to determine at which point the waveform on the first channel can be 'reconstructed', i.e. whether it is possible to read the current number of samples in the FIFO? I have had a look at the M-Series register map document, and I cannot see anything beyond the full, half full & empty status checks.

Any ideas on how to get around this problem would be greatly appreciated.

Kind regards,
Jon
0 Kudos
Message 1 of 3
(6,749 Views)

Hi Jon-

You're correct- the operation you need seems contrary to the normal operation of a FIFO.  There's not a built-in functionality to query the FIFO status beyond the empty, ~half-full, and full states.

It seems like the latency of buffer updates might be the problem you're trying to address.  This seems like a reasonable complaint; I'll guess that you are noticing longer than desired latencies between when you write to the FIFO and when the data actually gets clocked out.  Since the AO FIFOs are relatively small, I'll assume that this also means you're using a relatively slow generation rate.  Please correct me if my assumptions are wrong.

One way to possibly lower the latency would be to increase the generation rate and simply pad the output FIFO with additional values as needed to preserve the desired waveform characteristics.  This way the FIFO would be cycled through much more often, so "fresh" FIFO data would appear on the outputs earlier.  This is really the only way I can think of to lower latency when using programmed-I/O to the AO FIFOs.

Hopefully this helps-

 

Tom W
National Instruments
0 Kudos
Message 2 of 3
(6,706 Views)
Hi Tom,

You are indeed correct about the slow generation rate. At the moment I have worked around the issue by generating the entire waveforms for the period I require (including the leading and trailing zeros for each wave), and this seems to work fine. If I encounter any limitations with this method I will definitely consider using a faster generation speed as you've suggested.

Many thanks,
Jon
0 Kudos
Message 3 of 3
(6,694 Views)