AnsweredAssumed Answered

Using Python (PyVISA) to control E4438C

Question asked by sbennett_apl on Oct 17, 2012
Latest reply on May 6, 2013 by andyTPE
In summary, I can write commands successfully to an instrument (the Agilent E4438C signal generator with ARB), but I can’t read them back.  I’m using PyVISA and have installed the Agilent IO libraries.

I have attached a script I created that illustrates the issue and a screenshot from the Agilent IO Monitor, which I will reference in the following paragraphs.

You can see in lines 9-31 above that Python is being used to access the instrument.  You should also be able to see in lines 9-19 that the command “RAD:ARB:STAT ON.\n” (note the trailing period before the new line string) is written and a success is returned.  I can also verify that the requested action is performed on the instrument.  Lines 20-31 show what happens when I try to read back the status.  The command “RAD:ARB:STAT?.\n” is written, but the read times out as indicated in line 29.

Lines 1-8 show the same sequence of actions using the interactive command utility provided with the Agilent Connection Manager.  Note that these commands do not have the trailing period before the new line string, and both the write and read commands are executed successfully, and the read command returns the proper value “1\n” indicating the status as “on.”

It seems like the PyVISA implementation adds this trailing period before the new line string, which does not seem to affect write commands but might be affecting read commands.

I’d appreciate any help or insight anyone might be able to provide.