Power Meter Remote Operation 1
N1911A/1912A P-Series Power Meters Programming Guide 55
Example 1:
10 ! Program to generate an SRQ when a channel A sensor
20 ! connect or disconnect occurs
30 !
40 ASSIGN @Pm TO 713 ! Power meter GPIB address
50 ON ON INTR 7 GOTO Srq_i! Define service request handler
60 CLEAR @Pm ! Selective device clear
70 OUTPUT @Pm;”*CLS;*RST” ! Clear registers and resetmeter
80 !
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