| Products > Test Equipment |
| DIY scan card for Keysight 34970A |
| << < (13/13) |
| voltsandjolts:
Firmware updated to include relay cycle counters to demonstrate the DAQ commands. They are just in RAM, so start at 0 on every power-up. See first post to download. The cycle counters are accessed from python like this: --- Code: ---import pyvisa as visa import time,sys #py -m pip install -U pyvisa #py -m pip install -U pyvisa-py (for the pure python backend) #py -m pip install -U pyserial #https://pyvisa.readthedocs.io/en/latest/index.html #How do I know if PyVISA-py is properly installed? Get info about PyVISA, the installed backends and their options: # python -m visa info #On Windows, you may have to uninstall the USBTMC specific driver installed by Windows and re-install a generic driver. #https://pyvisa.readthedocs.io/en/latest/introduction/configuring.html #rm = visa.ResourceManager('@py') # Use pure python backend #rm = visa.ResourceManager('@ivi') # Use IVI-VISA backend rm = visa.ResourceManager() # default backend #print('Available devices: ', rm.list_resources()) # Will show async serial devices (comports) as e.g. ASRL16::INSTR for COM16 print('\nOpening device:') inst = rm.open_resource('USB0::0x0957::0x2007::MY57007585::INSTR') #For the 34972A on USB #inst = rm.open_resource("ASRL3::INSTR", baud_rate = 115200) #For the 34970A on RS232 (need to edit port number appropriately 'ASRL?' and check instrument baud setting) #reading and writing values: #https://pyvisa.readthedocs.io/en/latest/introduction/rvalues.html #inst.write('*rst; *cls') #reset to power on state, clear status # After *rst we now have these settings: # 1PLC, 5½ digits resolution # scaling is OFF and scale values are cleared # sets the scan interval to immediate (0 seconds) and the scan count to 1 sweep. DEFAULT_TIMEOUT = 5000 # default timeout is 5 seconds inst.timeout = DEFAULT_TIMEOUT #print(inst.query('*IDN?')) #print('Slot 1 card type:') #print(inst.query(':SYST:CTYPE? 100')) #print('Slot 2 card type:') #print(inst.query(':SYST:CTYPE? 200')) #print('Slot 3 card type:') #print(inst.query(':SYST:CTYPE? 300')) print('DAQ Internal relay cycle count:') print(inst.query('DIAG:DMM:CYCLES?')) print('Scan card relay cycle count:') print(inst.query('DIAG:RELAY:CYCLES? (@301:322)')) #Clear DAQ Internal or the scan card cycle counts like this: #print(inst.query('CAL:SEC:STAT?')) #inst.write('CAL:SEC:STAT OFF,HP034970') #unsecure the instrument '970A #inst.write('CAL:SEC:STAT OFF,AT034972') #unsecure the instrument '972A #print(inst.query('CAL:SEC:STAT?')) #inst.write('DIAG:REL:CYCL:CLE (@320)') #clears the relay cycle count on channel 20 in card slot 300 #inst.write('DIAG:REL:CYCL:CLE (@118)') #clears the relay cycle count on channel 18 in card slot 100 #inst.write('DIAGnostic:DMM:CYCLes:CLEar 1') #clear internal DMM relay cycle count K102 #inst.write('DIAGnostic:DMM:CYCLes:CLEar 2') #clear internal DMM relay cycle count K103 #inst.write('DIAGnostic:DMM:CYCLes:CLEar 3') #clear internal DMM relay cycle count K104 #inst.write('CAL:SEC:STAT ON,HP034970') #secure the instrument '970A #inst.write('CAL:SEC:STAT ON,AT034972') #secure the instrument '972A --- End code --- |
| Navigation |
| Message Index |
| Previous page |