Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

non-regenerative analog output in C#

Solved!
Go to solution

Hello,

 

Does anyone have any experience implementing a continuous, non-regenerative analog output in C#. Specifically, I am looking to control the output of several channels, simultaneously over many hours all of which will have non-repeating voltage waveform.  

 

This will require writing new data, pulled from a file stored on my hard drive, to my DAQ's buffer while that DAQ is delivering the previously loaded buffer. I understand that there are non-regenerative methods built into DAQmx to handle this, I just don't know how to manipulate these methods using C#. Any code snippets, function references or examples would be much appreciated. Thanks!

 

-Jon 

0 Kudos
Message 1 of 3
(4,247 Views)

Here is a non-regenerative example in C# that you can use as a starting point. 

 

-Christina

 

0 Kudos
Message 2 of 3
(4,198 Views)
Solution
Accepted by topic author neuronerd

Thanks Christina,

 

I ended up figuring everything out. That example was very helpful, but it is a bit of a cheat.

 

Within the example is a recursive method that loads the stimulus buffer (its called Callback or something).  Before this is run, the AO task is such that a buffer can only be loaded once half the samples have been read via

 

myTask.AOChannels.All.DataTransferRequestCondition = AODataTransferRequestCondition.OnBoardMemoryHalfFullOrLess;

 

to effectively support a double-buffered system. However, even if the code cannot load the buffer, it still spins around computing a new waveform to load and then realizing it cannot load it. I wanted something that waited to produce a buffer exactly when the DAQ buffer was half empty. This way, a chuck of a waveform could be read off a file on my hard disk every so often and inserted into the DAQ buffer without ever missing a step. I modified your example to show how to do something like this. I hope others will find it helpful.

 

-Jon 

0 Kudos
Message 3 of 3
(4,159 Views)