I'm trying to setup a collection of old HP-IB instruments for programmatic access, but I'm having some trouble reading data from devices. Sending data works fine. I'm using an Agilent E5810A LAN/GPiB gateway as the HPIB interface.
I've tried two methods: the first is simply to login to the e5810a web interface using the local IP and the "Find & Query Instruments" tab. The second is to use the python-vxi11 package. Both methods yield the same results. For example, here's the output when using python-vxi11:
>>> import vxi11
>>> e5810_ip = "192.168.4.43"
>>> e5810 = vxi11.InterfaceDevice(e5810_ip)
>>> e5810.find_listeners()
[22]
>>> hp3457a = vxi11.Instrument(e5810_ip, "gpib0,22")
>>> hp3457a.write("RESET")
>>> hp3457a.write("NPLC,100")
>>> hp3457a.write("DISP,OFF")
>>> hp3457a.write("DISP,ON")
>>> hp3457a.write("NPLC,10")
>>> hp3457a.ask("STB?")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/nix/store/3582hv8bqn3b6rv7gs0llxpakwpj2ncj-python3-3.9.9-env/lib/python3.9/site-packages/vxi11/vxi11.py", line 743, in ask
return self.read(num, encoding)
File "/nix/store/3582hv8bqn3b6rv7gs0llxpakwpj2ncj-python3-3.9.9-env/lib/python3.9/site-packages/vxi11/vxi11.py", line 731, in read
return self.read_raw(num).decode(encoding).rstrip('\r\n')
File "/nix/store/3582hv8bqn3b6rv7gs0llxpakwpj2ncj-python3-3.9.9-env/lib/python3.9/site-packages/vxi11/vxi11.py", line 701, in read_raw
raise Vxi11Exception(error, 'read')
vxi11.vxi11.Vxi11Exception: 15: IO timeout [read]
All the write commands appear to work as expected. Using the web interface is similar, but I just enter the contents between the quotes in the entry line and then use send or query instead of write or ask, respectively.
Several other observations:
- using the "Read STB" button of the E5810A web interface works: it reads data fine. So, it seems like I'm doing something wrong with my queries, rather than there being a hardware fault. I also get the same results for another instrument, which also suggests the problem is with something I'm doing.
- the 3457A seems to beep when I give it a bogus command (e.g., write("badcmd")). But the timeouts don't beep.
I expect I'm missing something simple here, but I don't see it. Any help appreciated, thanks!