Reading the Analyzer's Status Register


The VNA has several status registers that your program can read to know when specific events occur. There are two methods of reading the status registers in the analyzer: the Polled Bit method and the Service Request method.

See Also

IEE 482 Common commands

Example: Status Reporting

Status Commands

Other Topics about GPIB Concepts

Important Notes:

The Status Registers

Most of the status registers in the analyzer have sixteen bits. For simplicity, this topic will illustrate their use with 8-bit registers. Bits in registers represent the status of different conditions inside of the analyzer. In the following graphic, a register is represented by a row of boxes; each box represents a bit. Bit 3 is ON.

 

Each VNA Status Register is actually comprised of the following registers. See an image of the VNA Status registers.

Transition registers are read-write and are unaffected by *CLS (clear status) or queries. They are reset to their default settings at power-up and after *RST and SYSTem:PRESet commands. The following are the default settings for the transition registers:

This means that, by default, the analyzer will latch all event registers on the negative to positive transition (0 to 1).

The following is an example of why you would set transition registers:

A critical measurement requires that you average 10 measurements and then restart averaging. You decide to poll the averaging bit. When averaging is complete, the bit makes a positive transition. After restart, you poll the bit to ensure that it is set back from 1 to 0, a negative transition. You set the negative transition bit for the averaging register.

Setting and Reading Bits in Status Registers

Both the Polled-Bit method and Service Request method require that you set and read status register bits.  Most of the VNA status registers contain 16 bits, numbered 0 to 15. Each bit has a weighted value. The following example shows how to set the bits in a 8-bit status register.

8-bit register

Bit

0

1

2

3

4

5

6

7

Weight

1

2

4

8

16

32

64

128

 

How to set bits 4 and 5 in the Standard Event Status Enable register:

Step

Example

1. Determine the weighted bit value for these bits

weights 16 and 32 (respectively)

2. Add these values together

16 + 32 = 48

3. Send this number as an argument in the appropriate command. (see Status Commands)

STAT:QUES:LIMIT1:ENAB 48


The Polled Bit Method

With the Polled Bit Method, your program monitors a bit in the status register that represents the condition of interest to you. When the VNA sets the bit to 1, your program sees it and responds accordingly.

Advantage: This method requires very little programming.

Procedure:

  1. Decide which condition to monitor. The Status Commands topic lists all of the possible conditions that can be monitored in the analyzer.

  2. Determine the command to be used to monitor the bit.

  3. Determine how often to poll the bit until it is set.

  4. Construct the routine to respond when the bit is set.


The Service Request (SRQ) Method

Your program enables the bits in the status registers representing the condition of interest. When the condition occurs, the VNA actively interrupts your program from whatever it is doing, and an event handler in your program responds accordingly. Do this method if you have several conditions you want to monitor or the conditions are such that it is not practical to wait for the condition to occur.

Advantage: This method frees your program to do other things until the condition occurs. The program is interrupted to respond to the condition.

Disadvantage: This method can require extensive programming depending on the number and type of conditions that you want to monitor.

Procedure:

1. Decide which conditions to monitor. The Status Commands topic lists all of the possible analyzer conditions that can be monitored.

2. Set the enable bits in the summary registers and the status byte register.

Enabling is like making power available to a light. Without power available, the switch can be activated, but the light won't turn ON. In the analyzer, without first enabling a bit, the condition may occur, but the controller won't see it unless it is enabled.

The condition, and the bit in the summary registers in the reporting path, must be enabled. This is like streams (conditions) flowing into rivers (summary registers), and rivers flowing into the ocean (controller). See the diagram of status registers in Status Commands.

Bit 6 of the status byte register is the only bit that can interrupt the controller. When any representative bit in the status byte register goes ON, bit 6 is automatically switched ON.

3. Enable your program to interrupt the controller. This is done several ways depending on the programming language and GPIB interface card you use. An example program is provided showing how this is done with in Visual Basic with a National Instruments GPIB card.

4. Construct a subroutine to handle the interrupt event. If you are monitoring more than one condition in your system, your event handler must determine which condition caused the interrupt. Use the *SPE command to determine the instrument that caused the interrupt, then poll the summary registers, then poll condition registers to determine the cause of the interrupt.