1
\$\begingroup\$

I'm using a modern NI USB-GPIB adapter with NI-MAX 19/488.2 to query an Agilent E8361A VNA with SCPI commands.

Commands such as *IDN? and SENS:FREQ:START? -- basically any command ending in a question mark -- returns the proper string with no hiccups. The problem is that anytime I send a command such as SENS:FREF:START 100mhz , the VNA sets the start frequency to 100 MHz but the VNA window displays the SCPI error -420 "Query Unterminated" and causes the NI-488.2 terminal to time out. I've tried setting the terminating character to CR, LF, and manually sending them both to no effect.

Any ideas how to eliminate those -420 errors?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Disagree on the close vote. SCPI and GPIB / 488.2 certainly fall under 'a communication scheme' as defined in the scope of EE.SE and equipment automation is a major component of test engineering, which of course covers both electrical and software engineering disciplines. \$\endgroup\$ Commented Oct 18, 2019 at 18:53

2 Answers 2

5
\$\begingroup\$

Welcome to EE.SE. Your first question is a good one!

Query Unterminated errors are due to the instrument not seeing the expected termination character in the SCPI string. The instrument is probably smart enough to process the commands ending in '?' without a termination character since in SCPI, there can't be anything after the '?' other than a termination character.

[Aside: I find that Keysight instruments- formerly Agilent, formerly Hewlett-Packard - handle missing terminations very well. Other manufacturers do not - there can be timeouts, or for some instruments using SCPI over USB, ther can be a complete bus hang requiring a power/cycle or unplug-replug to get communications going again.]

Most instruments expect either a newline or carriage return as a termination character. Try adding a \n or a \r to the end of your command strings in NI-MAX and see if the non-'?' commands work. You can also have NI-MAX automagically add termination characters.

To get an authoritative answer as to what termination character the instrument is expecting, review the E8631A programming reference guide. (I find it sometimes faster to just experiment with NI-MAX though.)

Also: when you are sending a non-query string, make sure you are just pressing 'send' because the instrument is not going to respond with anything. Sending it as a query (write/read) will cause a timeout. Normally if I am just sending a non-query command, I will either append ';SYST:ERR?' to the end or send 'SYST:ERR?' as a separate query, to know that the standalone command actually worked.

NOTE: Removed thanks from your question, stylistically thanks and personal taglines are not appropriate on SE sites. Thank your responders with upvotes, and after 24h or so feel free to accept an answer that you feel best answers your question.

\$\endgroup\$
1
  • \$\begingroup\$ Note, that there are some commands, which does not ends with '?' Eg. the TRANsfer in [MMemory](na.support.keysight.com/pna/help/latest/Programming/GP-IB_Command_Finder/Memory.htm) command in keysight VNA \$\endgroup\$ Commented Jun 1, 2021 at 14:49
1
\$\begingroup\$

Query unterminated usually means you tried to read from the instrument when it had nothing in its buffer to send. If you send a command, you should only use write, not ask. Only use ask for queries. It's also possible that you sent a command with something left over in the buffer, make sure you read everything after each query.

\$\endgroup\$
1
  • \$\begingroup\$ Yes, and check out your command with write instead of query. See what happens. The root-error should appear on the screen... \$\endgroup\$ Commented Jun 1, 2021 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.