I need to automate the measurement of delay between two signals using the oscilloscope. I am using MSO4104 from Tektronix. I programmed the oscilloscope for delay measurement, but I am not getting the output.
The measurement conditions are given below:
Signal 1
High-90%,Mid,20% Low 10% and EDGE-Falling
Signal-2 Low 10% ,Mid 20%, High 90 EDGE Raising
Please see my code below. After executing this code output is not coming.
Can you please tell me where I went wrong?
import pyvisa
from time import *
rm = pyvisa.ResourceManager()
rm.list_resources()
#print(rm.list_resources())
scope = rm.open_resource('USB0::0x0699::0x0401::C002760::0::INSTR')
IDN = scope.query('*IDN?')
print ('Successfully connected to: ', IDN)
scope.write("*RST")
scope.write('SELECT:CH1 ON')
scope.write('SELECT:CH2 ON')
scope.write("AUTOset EXECute")
sleep(5)
scope.write("MEASUrement:REFLevel:METHod PERCent")
scope.write("MEASUREMENT:IMMED:DELAY:DIRECTION FORWARDS")
#For Channel_1
scope.write("MEASUrement:IMMed:SOURCE CH1")
scope.write("MEASUrement:IMMed:DELay:EDGE1 FALL")
scope.write("MEASUREMENT:REFLEVEL:PERCENT:HIGH 90")
scope.write("MEASUREMENT:REFLEVEL:PERCENT:MID 20")
scope.write("MEASUREMENT:REFLEVEL:PERCENT:LOW 10")
#For Channel_2
scope.write("MEASUrement:IMMed:SOURCE CH2")
scope.write("MEASUrement:IMMed:DELay:EDGE2 RISE")
scope.write("MEASUREMENT:REFLEVEL:PERCENT:LOW 3")
scope.write("MEASUREMENT:REFLEVEL:PERCENT:MID 20")
scope.write("MEASUREMENT:REFLEVEL:PERCENT:HIGH 80")
sleep(10)
scope.write("MEASure:DELay CH1,CH2")
sleep(10)
Delay_1_2 = scope.query('MEASure:DELay? CHANNEL1,CHANNEL2')
print('Delay is:',Delay_1_2)
scope.close()
rm.close()