Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyvisa
- import json
- import re
- #Currently setup with a square wave on channel 5.
- #can't get streaming "WAVEFORM?" to work, so going to save .trc files for later analysis.
- #this https://github.com/yetifrisstlama/readTrc/blob/master/readTrc.py may be of value.
- #https://pyvisa.readthedocs.io/en/1.8/api/resources.html#pyvisa.resources.GPIBInterface
- #http://cdn.teledynelecroy.com/files/manuals/maui-remote-control-and-automation-manual.pdf
- def setupScope():
- rm = pyvisa.ResourceManager()
- print(rm.list_resources())
- lecroy = rm.open_resource('USB0::0x05FF::0x1023::3805N01981::INSTR')
- print(lecroy.query("*IDN?"))
- lecroy.timeout = 5000
- print("Connection OK")
- return lecroy
- def measurementSetup(lecroy):
- #Dummy squarewave setup commands
- lecroy.write("TIME_DIV 5E-5")
- lecroy.write("COMM_HEADEROFF")
- #download waveform template
- wftmp = open("waveformtemplate.txt","w")
- wftmp.write(lecroy.query("TEMPLATE?"))
- wftmp.close()
- #print(lecroy.query("C5:INSPECT? \"SIMPLE\"")) #debugging, will dump until it times out.
- #lecroy.write("STO C5, FILE")
- lecroy.write("C5:WAVEFORM?")
- sample = open("sampleoutput.txt","w")
- sample.write(str(lecroy.read_raw()))
- sample.close()
- if __name__ == "__main__":
- lecroy = setupScope()
- measurementSetup(lecroy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement