Hello everyone,
I need some help with generating analog output.
In one loop, I am reading in 2 signals (400 samples @ 400 Hz) and passing them to a queue. A second loop, I am analyzing and classifying these signals into 3 states. Since I am reading 400 samples @ 400 Hz, I am performing classification once per second. If the classification is equal to a "target" classification, I have a boolean flagging detection. If detection is on, and a "stimulate" button is also on, I trigger another boolean flagging "stim". If "stim" is true I want to write an waveform to the AO channel
This analog output is carried out by a third loop. In this loop, I am initializing an AO channel (500 samples @ 10k Hz) and generating 500 points of a sinewave to be written to the AO channel. If "stim" is false, it multiplies the sine wave by zero (well actually is multiplies it by an exponential decay, but we'll say zero). If "stim" is true, then it passes the sinewave through to be written to the AO.
With this configuration, the VI will run, but after an indefinite amount of time the AO will stop being physically generated. I probed for an error and found "DAC conversion attempted before data to be converted was available...". A colligue suggested I try configuring an AO buffer as done here. Playing with number of samples per write, sampling rate, and buffer size, I now have a VI that runs without dropping out, but that has a 300ms delay before its written to the AO channel.
Does anyone have any suggestions as to how I can make this AO generation more "responsive" to when it is triggered by the "Stim" boolean?
The VI and all necessary sub VIs and files can be found in the zip file attached.