Remote Operation
Example Programs
| Example 9. Monitoring the status registers | |
Description | This program presets the analyzer and then selects the largest signal using | |
| automeasure. This program demonstrates the use of status registers to detect | |
| programming errors. A serial poll is performed to read the instrument status | |
| byte. The same status byte is read with *STB?. The internal error register is | |
| also read and displayed. The error queue is queried to display the error condi- | |
| tion. |
|
Program | PRINT “OSA Status Byte Example” |
|
| OUTPUT 723;”disp:wind:text:data ‘OSA Status Byte Example’” | |
| ! |
|
| !****************** Initialization routine ***************************** | |
| ! |
|
|
| |
| OUTPUT 723;”*rst” | ! Preset the analyzer |
| PRINT “Presetting the analyzer” |
|
| ! |
|
|
| |
| OUTPUT 723;”disp:wind:trac:all:scal:auto” | ! Automeasure |
| PRINT “Performing Automeasure” |
|
| ! |
|
| !*********************************************************************** | |
| ! |
|
|
| |
| ! Next line is the operation complete query used so that the text is not printed | |
| ! until after the Automeasure is complete |
|
| OUTPUT 723;”*opc?” |
|
| ENTER 723;Dum |
|
| PRINT “... measurement begins” |
|
| ! |
|
| OUTPUT 723;”*CLS” | ! Clear Error Queue |
| ! |
|
| OUTPUT 723;”*ESE 32” | ! Set Standard Event Enable bit 5(32) |
| ! |
|
| OUTPUT 723;”init:imm” | ! Take a sweep |
| ! Next line is the operation complete query used so that the text is not printed | |
| ! until after the Autoalign is complete |
|
| OUTPUT 723;”*opc?” |
|
| ENTER 723;Dum |
|
| ! |
|
| Sbyte=SPOLL(723) | ! Read serial poll status byte |
|
| |
| PRINT “Serial Poll Status Byte:”;Sbyte |
|
|
| |
| ! |
|
| OUTPUT 723;”*stb?” | ! Read the Status Byte Register |
| ENTER 723;Stat |
|
| PRINT “Status Byte Register:”;Stat |
|
|
|