Okay, first script, resets the meter and reads the output as fast as it can send it.
https://youtu.be/HWX6oFdah5s
Not the exact code I show in the video, only doing a reset 'H' below, resets to the default 10NPLC, DCV, Auto range, Auto Zero;
import visa
rm = visa.ResourceManager()
dvm = rm.open_resource('GPIB0::22::INSTR')
dvm.write('H')
try:
while True:
print(dvm.read('V'))
except KeyboardInterrupt:
print('Manual break by user')
Final part3, dynamic reading update while the script is running, log formatting and making a simple plot. Don't think I'm going to do much more with the 3456A, this was just a starter exercise, started playing with Python and TSP commands on the DMM7510 last night.
https://youtu.be/ASu6DuDdVmA
# Stewart Labs HP 3456A PyVisa logging script
# Logging
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s.%(msecs)03d , %(message)s',
datefmt='%Y/%m/%d %H:%M:%S',
filename='3456A_test_log.txt')
# Visa
import visa
rm = visa.ResourceManager()
dvm = rm.open_resource('GPIB0::22::INSTR')
#del dvm.timeout
# Instrument Config
dvm.write('H6STG')
# Clear Screen
import os
os.system('cls')
print('***Logging started - CTL+C to STOP\nSee 3456A_test_log.txt for data\n\nCurrent reading')
count = 1
# Query Loop
try:
while True:
mes = dvm.query('V')
red = mes.strip('\n')
logging.info(red)
print("#", count, "=", red, end='', flush=True)
count += 1
except KeyboardInterrupt:
print('*** Manual break by user***\nClosing log & reseting DMV\n')
dvm.write('H6STG')
Final part3, dynamic reading update while the script is running, log formatting and making a simple plot. Don't think I'm going to do much more with the 3456A, this was just a starter exercise, started playing with Python and TSP commands on the DMM7510 last night.
https://youtu.be/ASu6DuDdVmA
# Stewart Labs HP 3456A PyVisa logging script
# Logging
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s.%(msecs)03d , %(message)s',
datefmt='%Y/%m/%d %H:%M:%S',
filename='3456A_test_log.txt')
# Visa
import visa
rm = visa.ResourceManager()
dvm = rm.open_resource('GPIB0::22::INSTR')
#del dvm.timeout
# Instrument Config
dvm.write('H6STG')
# Clear Screen
import os
os.system('cls')
print('***Logging started - CTL+C to STOP\nSee 3456A_test_log.txt for data\n\nCurrent reading')
count = 1
# Query Loop
try:
while True:
mes = dvm.query('V')
red = mes.strip('\n')
logging.info(red)
print("#", count, "=", red, end='', flush=True)
count += 1
except KeyboardInterrupt:
print('*** Manual break by user***\nClosing log & reseting DMV\n')
dvm.write('H6STG')
Awesome script :-+ I have a 3456A and I'm working on using it for data logging. I'll have to give this a try, but I'm using Prologix GPIB-Ethernet Controller. I'll see what I can pull off with this. Thanks!