I'm trying to use the AD2 to act as both a signal source (wavegen1) and a measurement (scope1) device for the purpose of tracking conduction delay of the signal. Currently, I simply have the wavegen1 connected directly to scope1 with 3 cycles of a sine wave being put out. I am aware of the measure command to find the maximum on my scope1 but I was wondering if there was a way to find N (3 in my case) maximums AND find the corresponding times with respect to the timing of wavegen1? I plan to assume the timing of the wavegen1 is relatively accurate to my input frequency and can find the theoretical maximum thus having the initial time from which to subtract from my scope1 maximum times.
Code thus far
function doPing(){
print("Amplitude and Time Delay Recorded");
// User Inputs
var Freq = 5e3;
var Amp = 1.0;
var N = 3;
// WaveGen Settinngs
Wavegen1.Synchronization.text = "Synchronized";
Wavegen1.States.Trigger.text = "None";
Wavegen1.States.Wait.value = 0;
Wavegen1.States.Run.value = N/Freq;
Wavegen1.States.Repeat.value = 1;
Wavegen1.Channel1.Mode.text = "Simple";
Wavegen1.Channel1.Simple.Offset.value = 0.0;
Wavegen1.Channel1.Simple.Amplitude.value = Amp;
Wavegen1.Channel1.Simple.Frequency.value = Freq;
// Scope Settings
Scope1.Trigger.Trigger.text = "Repeated";
Scope1.Trigger.Type.text = "Auto";
Scope1.Trigger.Source.text = "Wavegen 1";
Scope1.Trigger.Condition.Text = "Rising";
Scope1.Trigger.Level.value = Amp/2;
// Start instruments
Scope1.run();
wait(0.1);
Wavegen1.run();
// Measure
var maximum = Scope1.Channel1.measure("Maximum");
print(N+" Max: "+maximum+" V"); //Want to do for 1:N and get time and amplitude with relation to time zero being the zero of the wavegen
//Close out instruments
Scope1.stop();
Wavegen1.stop();
}
if(!('Wavegen1' in this) || !('Scope1' in this)) {
throw("Please open a Scope and a Wavegen instrument");
}
doPing();
Question
Ryne Horn
Hello again!
I'm trying to use the AD2 to act as both a signal source (wavegen1) and a measurement (scope1) device for the purpose of tracking conduction delay of the signal. Currently, I simply have the wavegen1 connected directly to scope1 with 3 cycles of a sine wave being put out. I am aware of the measure command to find the maximum on my scope1 but I was wondering if there was a way to find N (3 in my case) maximums AND find the corresponding times with respect to the timing of wavegen1? I plan to assume the timing of the wavegen1 is relatively accurate to my input frequency and can find the theoretical maximum thus having the initial time from which to subtract from my scope1 maximum times.
Code thus far
function doPing(){ print("Amplitude and Time Delay Recorded"); // User Inputs var Freq = 5e3; var Amp = 1.0; var N = 3; // WaveGen Settinngs Wavegen1.Synchronization.text = "Synchronized"; Wavegen1.States.Trigger.text = "None"; Wavegen1.States.Wait.value = 0; Wavegen1.States.Run.value = N/Freq; Wavegen1.States.Repeat.value = 1; Wavegen1.Channel1.Mode.text = "Simple"; Wavegen1.Channel1.Simple.Offset.value = 0.0; Wavegen1.Channel1.Simple.Amplitude.value = Amp; Wavegen1.Channel1.Simple.Frequency.value = Freq; // Scope Settings Scope1.Trigger.Trigger.text = "Repeated"; Scope1.Trigger.Type.text = "Auto"; Scope1.Trigger.Source.text = "Wavegen 1"; Scope1.Trigger.Condition.Text = "Rising"; Scope1.Trigger.Level.value = Amp/2; // Start instruments Scope1.run(); wait(0.1); Wavegen1.run(); // Measure var maximum = Scope1.Channel1.measure("Maximum"); print(N+" Max: "+maximum+" V"); //Want to do for 1:N and get time and amplitude with relation to time zero being the zero of the wavegen //Close out instruments Scope1.stop(); Wavegen1.stop(); } if(!('Wavegen1' in this) || !('Scope1' in this)) { throw("Please open a Scope and a Wavegen instrument"); } doPing();
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.