7. Instrument Error Checking

Instrument error checking (further referred to as error checking) is the second most important aspect of your remote-control application. The goal of error checking is to assure error-free communication with your instrument, so that all desired settings have been correctly performed, and the measurement results obtained have been acquired using the desired settings.

A part of the instrument status subsystem is a error messages buffer called Error Queue. If you, for example, send a SCPI command that the instrument does not recognize, it generates a new entry in the Error queue. Error queue has a finite length, usually 10 entries and the oldest entry is discarded to make space for a new one.

Explained in chapter Measurement Sychronization, the Status Byte contains Bit 2 - Error Message Available. To find out whether the Error queue is empty, query the *STB? bit 2. If its value is 0, continue further with no additional actions. Otherwise, use the SCPI query SYSTem:ERRor?. The instrument returns the last generated error e.g. -113,”Undefined Header”. At the same time, this entry is deleted from the Error queue. To read all the entries, you need to call the SYSTem:ERRor? in a loop until you receive the response 0,”No Error” indicating that there are no more errors pending.

The following VISA Trace shows error checking in action:

  • The first command *RST is sent correctly, resulting in no error being generated.
  • The second command *RSaT is misspelled, which generates -113, "Undefined Header" error. The SYST:ERR? query is sent in a loop until the response is 0,"No Error"
RsVisaTraceTool log with error checking
RsVisaTraceTool log with error checking
Lightbox öffnen

If you use instrument drivers, the error checking is already implemented and performed in every function and after setting every Property (Attribute). This is very convenient, since you are immediately informed that the error that has occurred and after which command it has occurred. If you require maximum speed, the drivers offer the possibility to switch this feature OFF (see the first tip of the next Chapter 8: Speed Optimization).

If you use direct SCPI commands, you need to take care of the error checking yourself. We recommend to do the error checking after logical block of commands. Here, keep in mind that the more commands you send in one block, the harder it is to point to a specific command that has generated the error.

Let us take the example from the previous Chapter 6: Measurement Synchronization and focus only on the actions in the PC. Practical implementation of error checking we show in the examples that are linked in that chapter. The picture below shows the error checking performed after logical blocks of commands:

Informationen anfordern

Haben Sie Fragen oder benötigen Sie weitere Informationen? Nutzen Sie hierzu einfach unser Kontaktformular und wir setzen uns umgehend mit Ihnen in Verbindung.

Ich möchte Informationen von Rohde & Schwarz erhalten per

Marketing-Einverständniserklärung

Was bedeutet das im Einzelnen?

Ich bin damit einverstanden, dass die ROHDE & SCHWARZ GmbH & Co. KG und die im Impressum dieser Website genannte, ROHDE & SCHWARZ zugehörige Gesellschaft oder Niederlassung, mich über den gewählten Kommunikationskanal (E-Mail oder Post) zu Marketing- und Werbezwecken kontaktiert (z.B. zur Übersendung von Informationen über Sonderangebote und Rabattaktionen), die in Zusammenhang mit Produkten und Lösungen aus den Bereichen Messtechnik, sichere Kommunikation, Monitoring and Network Testing, Rundfunk- und Medientechnik sowie Cybersicherheit stehen, aber nicht auf diese beschränkt sind.

Ihre Rechte

Diese Einverständniserklärung kann jederzeit durch Senden einer E-Mail, in deren Betreffzeile "Unsubscribe" steht, an news@rohde-schwarz.com, widerrufen werden. Darüber hinaus enthält jede von uns versandte E-Mail einen Link, durch den das Abbestellen zukünftiger Werbung per E-Mail möglich ist. Weitere Einzelheiten zur Verarbeitung personenbezogener Daten und zum Widerrufsverfahren finden sich in unserer Datenschutzerklärung..

Ihre Anfrage wurde erfolgreich versendet. Wir nehmen in Kürze Kontakt mit Ihnen auf.
An error is occurred, please try it again later.