[time-nuts] controlling instruments using USB
jimlux
jimlux at earthlink.net
Tue Jul 26 01:02:51 UTC 2016
Semi-off-topic..
I've got a bunch of Keysight/Agilent/HP instruments with USB interfaces
that I want to control from Python. On Mac and PC, the PyVisa library
works great (either the one with the NI back end or the python only back
end )
But, on Ubuntu, there's no way to install the NI drivers (RH install
only, and Ubuntu is debian..)
So, I've been doing usbtmc, which sort of works. (after figuring out
all the udev rules stuff)
If I do something like this from the python interpreter:
>>> import usbtmc
>>> myinst = usbtmc.Instrument( mfr, product)
>>> myinst.write('some command')
it works fine.
But if I put the same three linesin a .py file and run it, it doesn't
always work.. sometimes, you need to send the command twice.
It seems it might be a timing thing (in libusb or usbtmc?) but putting
some sleep() in between connecting to the instrument and doing the write
doesn't seem to work all the time.
Very curious.
Any ideas?
More information about the Time-nuts_lists.febo.com
mailing list