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
|
from qolab.hardware.basic import BasicInstrument
from qolab.hardware.multimeter import MultimeterSCPI
from qolab.hardware.scpi import SCPI_PROPERTY
class HP_34401(MultimeterSCPI):
""" HP 34401 multimeter (same as Agilent) """
"""
rm = pyvisa.ResourceManager()
instr=rm.open_resource('ASRL/dev/ttyUSB0::INSTR', baud_rate = 9600)
"""
def __init__(self, resource, *args, baud_rate=9600, data_bits=8, parity=None, stop_bits=1, timeout=1, **kwds):
super().__init__(resource, *args, **kwds)
self.config['Device model']='hp 34401'
# self.resource.read_termination='\n'
self.deviceProperties.update({})
measurement = SCPI_PROPERTY(scpi_prfx='SYSTem:REMote\n read', ptype=float, doc='Report current measurement', no_setter=True)
if __name__ == '__main__':
import pyvisa
print("testing")
rm = pyvisa.ResourceManager()
print(rm.list_resources())
instr=rm.open_resource('ASRL/dev/ttyUSB0::INSTR', baud_rate = 9600)
multimeter = HP_34401(instr)
print('------ Header start -------------')
print(str.join('\n', multimeter.getHeader()))
print('------ Header ends -------------')
|