prog.book : chapter1.fm 77 Mon Feb 15 09:24:37 1999
Power Meter Remote Operation
Status Reporting
HP E4418B/E4419B Programming Guide 1-77
90 ! Configure the device status register so that a sensor
100 ! connect or disconnect on channel A will cause an SRQ.
110 !
120 OUTPUT @Pm;”STAT:DEV:ENAB 2”
130 OUTPUT @Pm;”STAT:DEV:NTR 2”
140 OUTPUT @Pm;”STAT:DEV:PTR 2”
150 OUTPUT @Pm;”*SRE 2”
160 !
170 ENABLE INTR 7;2 ! Enable an SRQ to cause an interrupt
180 LOOP ! Idle loop
190 ! Forever
200 END LOOP
210 !
220 ! When a SRQ is detected , the following routine will
service it.
230 !
240 Srq_i: !
250 St=SPOLL(@Pm) ! Serial Poll (reads status byte)
260 IF BIT(St,1)=1 THEN ! Device status reg bit set ?
270 OUTPUT @Pm;”STAT:DEV:EVEN?” ! Yes , read register
280 ENTER @Pm;Event ! (this also clears it)
290 OUTPUT @Pm;”STAT:DEV:COND?”
300 ENTER @Pm;Cond
310 IF Cond=0 THEN
320 PRINT “Sensor disconnected”
330 ELSE
340 PRINT “Sensor connected”
350 END IF
360 END IF
370 GOTO 170 ! Return to idle loop
380 END
Example 2:
10 ! Program to generate an SRQ when an over limit
20 ! condition occurs.
30 !
40 ASSIGN @Pm TO 713 ! Power meter HPIB address
50 ON INTR 7 GOTO Srq_i ! Define service request handler
60 CLEAR @Pm ! Selective device clear
70 OUTPUT @Pm;”*CLS” ! Clear registers
80 OUTPUT @Pm;”SYST:PRES” ! Preset meter
90 !