Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i get input from a tds2012B scope into a graph

I've downloaded the drivers and generated the wrapper, so from here, all I need to do is get input from my scope and put it into the graph object in my form right? I'm used to CVI sadly, and am only a beginner at C#.
 
here's what I have
 

private void Fetch_Wave_Button_Click(object sender, EventArgs e)

{

double [] mywavedata = new double[1000];

AnalogWaveform<Double> mywaveform = new AnalogWaveform<Double>(1000);

int actualpoints;

double initialx;

double increment;

scope.AutoSetup();

scope.EnableChannel(

"CH1");

scope.FetchWaveform(

"CH1", 1000, mywavedata, out actualpoints, out initialx, out increment);

Graph.PlotWaveform(

mywavedata);

return;

}

 

I guess I'm probably close here but the issue is, FetchWaveform gives me a double array, whereas PlotWaveform takes an analogwaveform, so the question is:

A). how do i convert from double [] to analogwaveform, and

B). is there a better/easier way to do what i'm trying to achieve?

0 Kudos
Message 1 of 3
(3,366 Views)
somewhat solved, tho I could still use a some feedback on methodology... here's what I got to work
 
 

private void Fetch_Wave_Button_Click(object sender, EventArgs e)

{

double [] mywavedata = new double[1000];

double initialx;

double increment;

int count;

AnalogWaveform<Double> mywaveform;

ConfigureScope();

scope.FetchWaveform(

"CH1", 1000, mywavedata, out count, out initialx, out increment);

mywaveform =

AnalogWaveform<Double>.FromArray1D(mywavedata);

Graph.PlotWaveform<

Double>(mywaveform);

return;

}

private void ConfigureScope()

{

scope.AutoSetup();

scope.EnableChannel(

"CH1");

}

0 Kudos
Message 2 of 3
(3,363 Views)
Hi Daniel,

Based on what you have posted, your approach looks correct.  Converting to a Waveform using the FromArray1D is the easiest way to display a double array as a waveform in Measurement Studio.
0 Kudos
Message 3 of 3
(3,346 Views)