ScpiInstrument control

I have a temperature chamber that I have added to Keysight IO Connection Expert so the Editor can pick up the instrument in the GUI. I have also used the Interactive IO to communicate with the instrument, but only after changing the termination character to \r\n.
However, OpenTAP is not able to communicate with it. The resource uses the ScipInstrument, and I suspect it may be because of the TeminationCharacter.
How can I change the TerminationCharacter of a ‘SOCKET’ instrument>


Are you trying to use the Command Expert plugin in Editor?

I think this is possible.

In the ScpiIo class, there is a Termination Character, which is just a single byte. You are trying to handle a \r\n, which is obviously 2 bytes.

You could Inherit from ScpiIo, set the Termination character to \n , then override the Read methods to call the parent method, but also trim \r from the data, then return that. You should then be able to pass the ScpiIo object to the ScpiInstrument constructor (public ScpiInstrument(IScpiIO2 io))

Cheers @alan_copeland,

I noticed my post had referred to ‘Command Expert’, so I’ve corrected it to ‘Connection Expert’.
I’m not trying to use the ‘Command Expert’ plugin but rather build a custom plugin resource for my instrument.
I was hoping I could set the termination character in the Open call for the resource but as you point out it’s 2 bytes.

        public override void Open()

            var scpiIo = (IScpiIO)this;

            // This 
            scpiIo.TerminationCharacter = "\r\n";

            // ...or this.

            this.VerboseLoggingEnabled = false;
            this.QueryErrorAfterCommand = false;
            this.SendClearOnConnect = false;
            IsConnected = true;

The code above won’t compile because I’m just demonstrating what I wanted in a simple ScpiInstrument.

I think @alan_copeland’s suggestion will be the only way for now. I did create this enhancement request:

1 Like

Hi @jason.hicks ,

How about overriding ScpiQuery ,Scpi Command and append “\r” .
\n will be default appended. So don’t need append \n.


This again illustrates the need for a ‘VisaInstrument’ class in between the ScpiInstrument and Instrument classes with more flexible VISA I/O.
The ScpiInstrument class works well for SCPI (and therefore 488.2) compatible devices.
But for non-SCPI, older GPIB devices, RS232 devices etc. requiring control of write (and read !) termination characters, setting baudrate etc. more flexible I/O is required.


Such a simple solution and it worked flawlessly.

1 Like