Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform in real time

Hi!
Can someone tell me how can I plot a wave form in real time? I mean, can read an analogic input and plot it in real time? I´m using C# languaje...

Thanx!

JOAN#
0 Kudos
Message 1 of 4
(3,834 Views)
I have the same question.
 
I have an application that receive data (1 single float) from 8 channels at 1000Hz.
 
How it is possible to plot it in real time?
 
Is there a samples somewhere or a tutorial to help me assure the way we use a waveform graph is the most efficient one.
Some basics tests show that it is not so easy to do.
 
Any insights someone?
0 Kudos
Message 2 of 4
(3,803 Views)

This may be overkill, but the example DAQmxWithUI/SynchronizeTwoAIContinuous does what you're asking.  Ultimately, there are only three functions to call for every update: EndReadWaveform, PlotWaveformAppend, and BeginReadWaveform (to start things going again).  All the action takes place in the callback.

Hopefully that helps!

John

0 Kudos
Message 3 of 4
(3,774 Views)

Thanks John for your reply,

I was able to acheive my goal. May I add some hints how I did it?

There is one thing that is very important when ploting data in real time, its to minimize the number of calls to the graphical object (for exemple WaveformGraph).

The only thing to do is to buff the data into a double[] buffer (or a jagged array of double [] if more than 1 waveform plot is used). Then you call PlotAppendY with that buffer.

The thing that can't be done and that was my mistake, its to call for every data coming in PlotAppendY. This is very unoptimized.

The size of the buffer depends on the rate the data coming in and the capacity of the history buffer of each waveform plot.

I'll try to develop a little formula (function of the data rate and the history size) that can fit common today's computer specs. (I'll test it only on mine ...)

I'll post it when I'm done with it. In the mean time, if someone got one, feel free to save me some time by posting it before me!

Regards,

Jean

0 Kudos
Message 4 of 4
(3,741 Views)