AnsweredAssumed Answered

Synchronized command execution over RS-232 with Keysight E3646A

Question asked by derjan on Apr 13, 2015
Latest reply on Apr 13, 2015 by derjan
I have a E3646A power supply here that I want to program using the RS-232 interface. So far, on different instruments, I've been using the *OPC? command to wait until the current command has executed successfully. The code would basically boil down to something like this (in Python):

*Version 1:*

s = serial.Serial('/dev/ttyUSB0', stopbits=2)
s.write('VOLT 2\n')
result = s.readline()

However, when I do this, the instrument does not return any data (readline eventually times out) and when the next command is sent the instrument will report an error: -410,"Query INTERRUPTED"

It does work when I change the code to contain a break between the commands, e.g.:

*Version 2:*

s.write('VOLT 2\n')
result = s.readline()

However, I don't like this solution particularly much since inserting sleep statements tends to be brittle and I've already found that some commands require longer sleep periods in order for the *OPC? to be recognized by the Power Supply. I've also found that the concatenating the commands to one line does work:

*Version 3:*

s.write('VOLT 2;*OPC?\n')
result = s.readline()

This seems a bit odd to me. Why can I chain the commands together on one line but not send them directly after one another.

So my questions would be:

1) Does this instrument require a time delay between two RS-232 commands and how big is the value required so that all commands will definitely work? I've found nothing specified in the documentation except the examples where they seem to use 500ms.
2) Is chaining an *OPC? command on the same line as the request the preferred way when using synchronized RS-232 with this instrument.

Using GPIB instead of RS-232 is not an option for me unfortunately.