Monday, September 28, 2015

Common SCPI Errors

Common SCPI Errors

Introduction

The Standard Commands for Programmable Instruments (SCPI) was first released with IEEE 488.2 (GPIB Standard Codes, Formats, Protocols, and Common Commands) specification in 1987.  SCPI defined a syntax, commands, and data formats to be used with all instruments.  It defined generic commands (e.g. SENSe, SYSTem and MEASure) that could be used with all instruments of a similar class.

SCPI defines the error query as “SYSTem:ERRor?” and a fairly complete set of errors that can be generated.  There are many types of errors and events defined (command, execution, device specific, and query). 

A quick note on SCPI mnemonics, SCPI typically defines a long form and short form for each command.  The mixed case indicates what is short form by what’s capitalized and the rest is the long form.  E.g. SYSTem means the SYST is the short form of system and is as valid as using “SYSTEM”.  SCPI mnemonics are case insensitive, so SYSTEM, SyStEm, and system are all valid.

Common Errors

I am just going to cover a few common errors and the likely causes for the error.  The first is the command error “Undefined header”.

-113,”Undefined header”

This indicates the instrument did not recognize the command message.  This is arguably the most common error during development.  It can be generated by transposing letters, misspelling, spaces in the wrong place, no separation between command and parameter, or a command not supported by this instrument.  E.g

Bad
:meas:rse?   // typo
:mews:res?  // typo
:meas: res?  // space after the :
:meas:res?100  // No space between ? and parameter.
:output:imp 10  // Not valid on measurement device.
Good
:meas:res?

The next two errors that will be discussed are “Query Errors”.  These errors are often confused with each other.  These errors indicate problems with the output queue and are defined in the IEEE 488.2 Message Exchange Protocol (MEP).  There are only two reasons these MEP errors occur:
  1.         Trying to read from the output queue when there is no data.
  2.         The data in the output queue has been lost.

The first of these errors that will be covered is “Query Interrupted”.

-410,”Query Interrupted”

This error is generated when you send a valid query and before reading the response you send another message.  Another way of saying this is the instrument was addressed to listen while it has contents in the output buffer.  This error can be avoided by staying in sync with the last query or command that generates output.  Examples of this error might include:

Send :system:error?
Send *opc?

This generated the “Queue Interrupted” because you must read the response from the “:system:error?” before sending another command or query that will generate output.

It’s also important to remember to read the entire response so after you have read the response the output queue is empty.  You do have to be aware if the instrument appends newlines to the end of responses and when reading responses that the newline is accounted for and not left in the output buffer.

The next Query Error to be discussed is “Query Unterminated”.

-420,”Query Unterminated”

This error is generated when you read from the instrument when the output queue is empty.  Some reasons for this might be a malformed query generated a “-113,”Undefined header” then the read will add the “Query Unterminated” error to the error queue.  If this error is caused by malformed program message that has multiple commands or queries, at the point this error is generated the remaining program message will be discarded so the parser is ready to accept another program message.

Non IEEE 488.2 Protocols

The last two errors discussed in this article are MEP errors that are defined in the IEEE 488.2 specification.  IO protocols that adhere to MEP are GPIB, USBTMC-USB488, VXI-11, and HiSLIP.  These IO protocols have the Message Exchange Protocol Enforcer (MEPE).  There are other protocols such as sockets and if you have old instruments RS-232 (think HP 33120A).  These protocols do not have MEPE and their behavior will be different and these Query Errors will not be generated.  For sockets, the behavior is dependent on how the socket is configured.  Typically the next read on the socket will hang or timeout.  Clearing out the parser might be as easy as doing a valid query e.g. “*stb?” to read the status byte or “:system:error?” to read the error queue.  Also, the IEEE 488.2 command “*cls” will clear the output queue, clear the MAV bit of the status byte, and forces the device to the idle state.  If the instrument supports the socket control channel, you can do a device clear.

Conclusion

These kinds of errors are most found when first writing an application using SCPI.  A well behaved application typically does not generate these errors but things do occur that will cause these errors, like missing a trigger and the assumption the reading is always there.  In general it’s a good idea to have a SCPI error handler to deal with any errors and to get the parser into a good state before continuing.


27 comments:

  1. We have the manuscript cover letter which will give much asperity as we compare to others. By the way It is an easier and quicker way to shape a these things..

    ReplyDelete
    Replies
    1. There are three SCPI errors which occur more often than any others:

      -113, "Undefined header"

      -410, "Query INTERRUPTED"

      -420, "Query UNTERMINATED"

      This paper gives likely causes for these errors, and ideas for avoiding them. My college essay writer write about this errors.

      Delete
  2. It was a discussion about SCPI commands and commonly found errors in it.The reasons behind these errors are explained over here. We have custom essay writing service to ask for help.

    ReplyDelete
  3. As a rule the negative whole number blunders are SCPI mistakes as characterized by the SCPI convention Assignment expert The positive whole number blunders are characterized by the maker.

    ReplyDelete
  4. As a rule the damaging whole number errors are SCPI faults as categorized by the SCPI agreement.the positive whole number was categorized by the best companies of Website Development Service in UAE they can use SCPI

    ReplyDelete
  5. Yes, I agree with the opinions you give, your sharing is very meaningful, thank you for sharing.
    abcya

    ReplyDelete
  6. I think I have a lot to learn about the Common SCPI Errors, something that I find very nice to find on the post. This is a page that I can boldly revisit, with an assurance of being provided with more relevant and quality information. With the most qualified MSC literature review writers, we have always provided high quality services to all people at any given time.

    ReplyDelete
  7. I appreciate your article, the errors you give me are also common. Thanks to your post I know how to handle it.

    run 3 online

    ReplyDelete
  8. You can ask us “is edubirdie legit and not a scam?’’. You can read all the information in our Terms of Use. But we are happy to remind you that Edu birdie runs its business under the current laws and regulations. We are a registered custom writing platform that has freelance writers on board to produce the premium-quality papers. If you want to know is Edurbirdie legal than we inform you that our business abides Local, State, National and International regulations and laws. Some people are afraid to use essay writing services as they do not want to pay money for plagiarized content and ask- Is Edubirdie cheating?

    ReplyDelete
  9. How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share!
    devast io

    ReplyDelete
  10. Thank for your writting! It is easy to understand and detailed. I feel it is interesting, I hope you continue to have such good posts.
    run 3

    ReplyDelete
  11. In the healthcare business, nurses are finding that individuals who have pursued an RN-BSN diploma program tend to be times prepared to proceed from traditional patient care to distinct roles in the health care sector. You can read more at here

    ReplyDelete
  12. We are a reputable writing company mental illness argumentative essay topics of international experience with creation of different types of essays for students of all levels of education. We have a team of professional writers of all possible scientific areas. That is why our agency is always confident about our essays being of the top quality. The assignments we provide for our customers always contain relevant information and facts.

    Due to a number of factors, the mental medicine is nowadays one of extremely popular scientific directions as long as scientists from all over the world explore the reasons for psychological problems, mental health argumentative essay, and the ways to overcome and treat them. People’s psychological peculiarities, behavior, and reactions to various factors and circumstances are under discussion and are carefully examined.

    ReplyDelete
  13. I think I have a long way to go about the Common SCPI Errors, something that I find exceptionally decent to discover on the post. This is a page that I can strongly return to Online Assignment Writers, I wished to a debt of gratitude is in order for giving your opportunity to this superb learns!! I certainly messing around with each and every piece of it and I have done your webpage as a bookmark to investigate new stuff you blog entry.

    ReplyDelete