
Chapter 6 173
Advanced Operations
HP-IB Service Requests
Example BASIC Program to Set Up and Service an
SRQ Interrupt
The following Agilent Technologies Instrument BASIC (IBASIC)
program was written for an HP 9000 Series 300 Controller and a Test
Set. The program assumes that the Test Set is the only instrument on
the bus. The program sets up an interrupt from the Standard Event
Status Register Group, the Calibration Status Register Group, and the
Hardware Status Register #1 Group. For demonstration purposes the
program is written to stay in a dummy loop waiting for an interrupt
from the Test Set
Example 6-108 Example
10 OPTION BASE 1
20 COM/Io_names/INTEGER Inst_address,Std_event_reg,Calibration_reg
30 COM /Io_names/ INTEGER Hardware1_reg,Srq_enab_reg,Status_byte,Event_reg
40 !
50 ! Define instrument address
60 Inst_address=714
70 !
80 PRINTER IS CRT
90 CLEAR SCREEN
100 !
110 ! Reset the Test Set to bring it to a known state
120 OUTPUT Inst_address;"*RST"
130 !
140 ! Clear the Test Set status reporting system
150 OUTPUT Inst_address;"*CLS"
160 !
170 ! Set up the desired interrupt conditions in the Test Set:
180 !
190 ! 1) Standard Event Status Register Group
200 ! Event register conditions which will set the Summary Message
210 ! TRUE if they occur:
220 ! Bit 5: Command Error decimal value = 2^5 = 32
230 ! Bit 4: Execution Error decimal value = 2^4 = 16
240 ! Bit 3: Device Dependent Error decimal value = 2^3 = 8
250 ! Bit 2: Query Error decimal value = 2^2 = 4
260 !
270 Std_event_reg=32+16+8+4
280 !
290 ! Set up the Standard Event Status Enable Register to generate the
300 ! Summary Message
310 !
320 OUTPUT Inst_address;"*ESE";Std_event_reg
330 !
340 ! 2) Calibration Status Register Group
350 ! Condition register conditions which will set the Summary Message
360 ! TRUE if they occur:
370 ! Bit 4: TX Auto-zero failed decimal value = 2^4 = 16
380 ! Bit 3: Voltmeter Self-cal failed decimal value = 2^3 = 8
390 ! Bit 2: Counter Self-cal failed decimal value = 2^2 = 4
400 ! Bit 1: Sampler Self_cal failed decimal value = 2^1 = 2
410 ! Bit 0: Spec Anal Self-cal failed decimal value = 2^0 = 1
420 !
430 Calibration_reg=16+8+4+2+1
440 !
450 ! Set the Transition Filters to allow only positive transitions in
460 ! the assigned condition(s) to pass to the Event Register
Komentáře k této Příručce