11.07.2015 Views

Agilent 33120A User's Guide

Agilent 33120A User's Guide

Agilent 33120A User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6 Application ProgramsUsing the Status RegistersUsing the Status RegistersThis program teaches the following concepts:œ How to use the Status Registers to generate an interrupt if a SCPIerror occurs. The program sets up the Status Byte and StandardEvent register and interrupts the controller if an error is detected.œ How to service the interrupt if an error occurs and read the functiongenerator’s error queue using the SYST:ERR? command.BASIC / GPIB (Program 4)10 !20 ! This program uses the status registers to generate an30 ! interrupt if a SCPI error occurs. The function generator40 ! is programmed to output an FM waveform.50 !60 CLEAR 7 ! Clear interface - send "device clear"70 ASSIGN @Fgen TO 710 ! Assign I/O path to address 71080 COM @Fgen ! Use same address in subprogram90 INTEGER Hpib,Mask,Value,B ! Declare integer variables100 OUTPUT @Fgen;"*RST" ! Reset function generator110 !120 ! Set up error checking130 !140 Hpib=7 ! GPIB select code is "7"150 ON INTR Hpib CALL Err_msg ! Call subprogram if error occurs160 Mask=2 ! Bit 1 is SRQ170 ENABLE INTR Hpib;Mask ! Enable SRQ to interrupt program180 !190 OUTPUT @Fgen;"*CLS" ! Clear status registers (clear out old errors)200 OUTPUT @Fgen;"*SRE 32" ! Enable "Standard Event" bit in Status Byte210 ! to pull the IEEE-488 SRQ line220 OUTPUT @Fgen;"*ESE 60" ! Enable error bits (2, 3, 4, or 5) to set230 ! "Standard Event" bit in Status Byte240 ! and wait for operation complete6261

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!