Hi,
you will find more information here:
http://blog.philippklaus.de/2014/02/agilent-u1273ahttps://www.mjoldfield.com/atelier/2011/06/agilent-macos.htmlHere an example code that worked for me on a Windows10 machine running Python 3.8
import serial
import time
from datetime import datetime
prevTimeStamp = datetime.now()
print(prevTimeStamp)
def send_receive(command):
print(command)
command = command + '\n'
ser.write(command.encode())
time.sleep(0.05)
received = ser.readline().decode('utf-8')
# print(received)
return received
"""
#possible commands
send_receive('*IDN?')
send_receive('SYST:BATT?')
send_receive('CONF?')
send_receive('STAT?')
send_receive('FETC?')
#send_receive('*RST')
send_receive('SYST:VERS?')
send_receive('SYST:ERR?')
"""
with serial.Serial('COM6', 9600, timeout=1) as ser:
for x in range(10):
line = send_receive('READ?')
# line = ser.readline().decode('utf-8')
# print(line, float(line.decode('utf-8')))
timestamp = datetime.now()
timeDelta = (timestamp - prevTimeStamp).microseconds
print(str(timestamp.second) + ',' + str(timestamp.microsecond), ' : ', float(line), "timedif to prev:",
timeDelta,
"microseconds")
prevTimeStamp = timestamp