From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Write multiple buffers to analog out

I have written an application that samples analog input channels continuously. Now I want to add a feature to create an analog output signal. However, all examples that I've seen so far only write to buffer only once. In my use case I need to output a signal with a high sample rate (> 200 kHz) and a long duration (several minutes to hours). Thus I will need to update the output buffer multiple times while the analog output generation is running.

 

It is important that there are no gaps between the buffers in the output signal, also if my application is to slow in filling the buffer I wish to get an underflow exception or at least be able to detect it from my software.

 

What is the recommended way to implement this in C#? From the documentation I think I should be able to use AnalogSingleChannelWriter.BeginWriteMultiSample/EndWrite with the callback to repeatably fill the buffer. Alternatively, I believe I could create a separate thread and call WriteMultiSample in a loop.

 

Is this correct?

0 Kudos
Message 1 of 1
(798 Views)