コード例 #1
0
 def addInstrument(self, addr):
     res = self._rm.open_resource(addr)
     try:
         idn = res.query('*idn?')[:-1]
         if (idn == ''):
             idn = res.query('ID?')
         mm = splitResourceID(idn)
         resadptr = VISAAdapter(mm[1], res)
         if self._debugOn: print("\t", addr, ":", idn)
         for icls in res_types:
             sup = icls.checkSupport(mm[1])
             if (sup):
                 self._instruments[sup].append(icls(mm, resadptr))
     except visa.Error:
         idn = "Not known"
コード例 #2
0
    def __init__(self, name, adapter, **kwargs):
        try:
            if isinstance(adapter, (int, str)):
                print(adapter)
                try:
                    adapter = VISAAdapter(adapter, adapter, **kwargs)
                except visa.VisaIOError as e:
                    print("Visa IO Error: check connections")
                    print(e)
        except ImportError:
            raise Exception(
                "Invalid Adapter provided for Instrument since PyVISA is not present"
            )

        self._name = name
        self._adapter = adapter
        self._active = True
コード例 #3
0
    #red,
    #blk,
    reduut,
    blkuut,
    #rcp
]
testclass = SerialPort

res = {}
addr_ps = "GPIB0::6::INSTR"
rm = visa.ResourceManager()
try:
    r = rm.open_resource(addr_ps)
    mm = splitResourceID(r.query('*idn?')[:-1])
    print(mm)
    adptr = VISAAdapter("TestAdapter", r)
    ps = PS(mm, adptr)
    ps.output_state(0)
    ps.voltage(26)
    time.sleep(1)
    ps.output_state(1)
except:
    print("Power Supply Error")
print(rm.list_resources())
print(win.listSerialPorts())

for addr in com_list:
    #print(addr)
    try:
        if (addr is stp):
            stp = testclass('stp', addr)
コード例 #4
0
ファイル: test_dmm.py プロジェクト: axs5489/pylab
	def setUpClass(cls):
		print('setupClass')
		cls.adptr = VISAAdapter("DMM", "GPIB0::7::INSTR")