Another one for the GPIB series on instrument control from Linux, this one for the Marconi 6960A RF power meter.
The output on the screen (guess the power was lower than on the first picture):
Together with the milivoltmeter (and launch icons) getting data for recording, the milivoltmeter software/hardware is for another post and it's not GPIB, it's rs232.
Code:
My instrument is set on GPIB id 8 so you might need to change to reflect yours:
(inst = rm.open_resource('GPIB0::8::INSTR'))
=== code start
import Tkinter as tk
import pyvisa
import time
rm = pyvisa.ResourceManager()
inst = rm.open_resource('GPIB0::8::INSTR')
counter = 0
def counter_label(label):
def count():
global counter
counter += 1
# power=inst.query("SR3SR-TR10SQ1")
power=inst.query("TR00")
power=power[3:] # renove the first 3 characters
power=float(power)
label.config(text=str(power)+" dBm")
label.after(1000, count)
count()
root = tk.Tk()
root.title(" RF power 6960A ")
label = tk.Label(root, fg="light green", bg ="dark green", font = "Helvetica 18 bold italic")
label.pack()
counter_label(label)
button = tk.Button(root, text=' EXIT ', width=35, command=root.destroy)
button.pack()
root.mainloop()
=== code end
Have fun!
The output on the screen (guess the power was lower than on the first picture):
Together with the milivoltmeter (and launch icons) getting data for recording, the milivoltmeter software/hardware is for another post and it's not GPIB, it's rs232.
Code:
My instrument is set on GPIB id 8 so you might need to change to reflect yours:
(inst = rm.open_resource('GPIB0::8::INSTR'))
=== code start
import Tkinter as tk
import pyvisa
import time
rm = pyvisa.ResourceManager()
inst = rm.open_resource('GPIB0::8::INSTR')
counter = 0
def counter_label(label):
def count():
global counter
counter += 1
# power=inst.query("SR3SR-TR10SQ1")
power=inst.query("TR00")
power=power[3:] # renove the first 3 characters
power=float(power)
label.config(text=str(power)+" dBm")
label.after(1000, count)
count()
root = tk.Tk()
root.title(" RF power 6960A ")
label = tk.Label(root, fg="light green", bg ="dark green", font = "Helvetica 18 bold italic")
label.pack()
counter_label(label)
button = tk.Button(root, text=' EXIT ', width=35, command=root.destroy)
button.pack()
root.mainloop()
=== code end
Have fun!
No comments:
Post a Comment