Hello,
I am generating a continuous waveform, and I need to guarantee that 0 is being written last. I though I had the analog generation methods figured out, but yesterday proved that I didn't.
Here is my train of thought:
I need to generate a periodic square wave for an indeterminate amount of time, so I create one period of data, and write this to an analog out task configured for continous output samples. This creates a buffer sized to one period of data. This performs as expected.
When the generation is complete, I write a full buffer of 0's and use a wait function configured for a buffer generation time + 50ms just to be sure that the buffer full of 0's actually gets output. However, this doesn't work, and depending when the generation is stopped, the output could be high or low.
Here is a picture of the VI I'm using:
In this case, I generate 75 samples clocked out at 100kS/s, so a full buffer is written in 750us. When the stop button is pressed, I write 75 0's (effectively overwriting the buffer) and then I wait 750us (gets truncated to 0ms) + 50ms just for good measure. I thought this would be plenty of time for the 0's buffer to be generated. My understanding was that the DAQmx Write filled up a buffer with the data, then every buffer period, the entire buffer is transferred to the card and generated. But I guess this isn't quite correct.
Anyway, if I increase the timing to 750us + 100ms, then the output is 0, but I was looking for a way to guarantee that the output is 0, and perhaps clarify my understanding of the analog output sequence.
Sorry for the verbose post, and thank you for any help,
Jon
Message Edited by bigg_jon on 03-23-2007 09:48 AM