Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with output buffer USB6216 C#.NET

Hi,

 

I am trying make a simple closed loop controller using the USB6216 and C#.Net. In the attached example code the output is simply the minimum of the last read samples from BeginReadMultiSample(). The problem is that somehow the output lags the input by approximately 8 s. The input on ai7, expected output, and actual output on ai3 are plotted in the first chart area. With the sampling rate of both the input and output set to 1k Hz, it seems this lag is because the callback to write more samples fills up the entire on board buffer of 8191 samples. To show this, in the bottom chart plots the number of times the output callback runs for each run of the input callback. Until the hardware buffer is full, there the output callback runs very frequently. Afterwards it continues to be called at the expected once per 100 ms. After a day looking through the documentation and the message boards I do not understand why the output callback runs that often and how I can avoid this situation.

 

Thanks,

Steve

Download All
0 Kudos
Message 1 of 1
(1,941 Views)