Just in case GVanHorn isn't available to reply (since his post is more than a year old). I just wanted to say that you may want to look at the CVI example program called "ContGen-IntClk.prj" as this should be a good starting point. You could easily modify this program to read data from a file each loop iteration and buffer the waveform that way. You'll want to generate continuously and turn off regeneration so you know if you keep the buffer full enough. I would recommend writing enough samples to the buffer each loop iteration so that you don't have to run the loop more than 10 times a second. For instance if you want to generate samples at a rate of 100 kHz then make sure that with each DAQmx Write call you buffer at least 10,000 samples from your file.
I hope this helps get you started, and have a great night!
Cheers,
Read sequence waveforms from text file
Loop
Read data waveform from data file
Read AO conditions: start time, end time, sample rate, channel
Call Generate AO
Configure the task: timing, number of samples, etc accordingly
Start task
Is this task done?
Is this the last AO generation?
yes: End AO generation
no : go to the top of the loop
I?m kind of lost about how to accomplish this since every AO generation is different. I'm having problems while trying to recall the next AO generation. I do not know how to synchronize these two events. Do you have any sample code or suggestions?
(I'm using Labwindows CVI 8.2 and DAQmx driver)
Thanks a lot.
In order to change task parameters such as the rate you need to stop the task. In your current structure you will have to stop the task, configure the next task, and then restart the task. If you take this approach then it will be difficult to synchronize the tasks because there will be some software timing in between waveforms, but you could probably get this within a few ms.
If you require better timing then this then you'll need to configure your waveforms to be output with the same channel parameters. For instance, if you have 2 waveforms that need to be output, one at 1 kHz and the other at 2 kHz, you could change your first waveform to have duplicate points (or interpolate points) so that it had twice as many and then could be output at 2 kHz. Then you could turn off regeneration for your output channel and just buffer both waveforms without changing any of the channel parameters. The second method would be the cleanest solution, but you'll need to modify your waveform data to have a consistent update rate.
Cheers,