06-08-2010 12:54 PM
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
Solved! Go to Solution.
06-09-2010 04:05 PM
Here is a non-regenerative example in C# that you can use as a starting point.
-Christina
06-14-2010 08:42 PM
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