Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Binding realtime AI Channel data to a gauge/tank/meter control in C#?

I am using .NET 2003 with Measurement Studio 7.1, preferably coding in C#. For hardware I am reading the conditioned (0 to 10V) output of a load cell and two strain gauges through a 6062E DAQ card.

I would like to bind gauge and meter form controls (not ActiveX) to the data on the AI channels in realtime. As far as I can tell, however, the only way to get AI channel data is through the method demonstrated in the ContAcqVoltageSamples_IntClk example. i.e. You have to create a virtual channel, create an AnalogMultiChannelReader, register a callback then call BeginReadMultiSample.
This gives you an array of doubles with some specified number of samples. I have tried reading one sample at a time but the system overwrites the buffer too fast for this, and obviously an array of 100+ values doesn't map to a gauge value. I would like to simply take the current virtual channel value and bind it to a WindowsForms.Meter.Value but I see absolutely no property or data object that provides the voltage reading from the AIChannel object.

How can I map my realtime data to a form control for display? This seems like it should be a common task in MStudio but I can find no example code or documentation of any sort on it.

Thank you for you help,

~J
0 Kudos
Message 1 of 2
(2,839 Views)
Hi Jtheletter,

You were likely receiving the buffer overflow error because the computer was not reading enough samples from the DAQ buffer each time. If you reduce the sampling rate to something like 10Hz, you should be able to read 1 sample each time. However, the data returned is still in an array, so you might have to do some array manipulation to grab the first element from the array and write it to the meter. I don't believe you can bind the control to a channel, but I would suggest posting this question in the Measurement Studio forum to confirm and see if there're other suggestions for showing the data.

Thanks,
Lesley Y.
0 Kudos
Message 2 of 2
(2,823 Views)