-
Notifications
You must be signed in to change notification settings - Fork 0
/
agilent6629a.py
60 lines (42 loc) · 1.25 KB
/
agilent6629a.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import pyvisa
rm = pyvisa.ResourceManager()
inst = None
def list_ports():
print(rm.list_resources())
def connect(port):
global inst
inst = rm.open_resource(port)
inst.write_termination = '\r\n'
inst.read_termination = '\n'
def get_id():
print(inst.query("*IDN?"))
def set_voltage(channel, voltage):
send_string = ("VSET{},{}".format(channel, voltage))
print(send_string)
inst.query(send_string)
def set_voltage_all(voltage):
send_string = ""
for i in range(1,5):
send_string += "VSET{},{};".format(i, voltage)
print(send_string)
inst.query(send_string)
def set_current(channel, current):
send_string = ("ISET{},{}".format(channel, current))
print(send_string)
inst.query(send_string)
def set_current_all(current):
send_string = ""
for i in range(1,5):
send_string += "ISET{},{};".format(i, current)
print(send_string)
inst.query(send_string)
def set_status(channel, status ):
send_string = "OUT{},{}".format(channel, int(status))
print(send_string)
inst.query(send_string)
def set_status_all(status):
send_string = ""
for i in range(1,5):
send_string += "OUT{},{};".format(i, int(status))
print(send_string)
inst.query(send_string)