Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

PyVisa debug and my own instrument simulator, hangs on *esr?

Hello,

 

I had to simulate a large number of instruments on a single PC to try to support a customer's software. They used PyVisa, so I remapped their configs from an ::INSTR (LXI) to simple sockets, and wrote my own simulator (opened a pile of ports, just need to handle a few queries really).

All ran fine, including *OPC?, queries about voltage/current settings, etc. etc., until I hit upon *ESR? I have no idea why the PyVisa driver times out on the query. I checked with Wireshark, checked read/write terminations, everything looks good. I tried sending "1", "+1", etc. from examples I saw, but the query just keeps timing out.

I'm sending the reply to the correct port, and as mentioned, the other commands and instruments I simulated are working.

Is there a way to debug this in the PyVisa driver/package/whatever? I'm using Python 2.7 and PyVisa for that version, and no other issues. In fact, I can even use the visa shell and talk to my simulator on the other machine and see the +1 being returned. But not from inside a script. Is this buried in the resource manager somewhere (the socket handling, etc.?).

Any help appreciated!

Avner Ginsburg

 

0 Kudos
Message 1 of 2
(3,283 Views)

Sorry all, answered!

I got lost in details - our customer's code was initializing an instrument twice, so the first socket was automatically being closed by the visa driver. But that was just a wild goose chase. The real answer was that for whatever reason, the code was not specifically setting read/write line termination characters. Obviously, the defaults don't work with normal ascii (either \r or \n or \r\n?).

 

I do wish I could have debugged this from the visa driver system itself: anyone know how to do that?

 

Thanks,

Avner

 

Message 2 of 2
(3,244 Views)