Programming Examples R&S®SML / R&S®SMV03
1090.3123.12 E-6 7.4
Service Request
The service request routine requires an extended initialization of the instrument in which the respective
bits of the transition and enable registers are set.
In order to be able to use the service request function in conjugation with a National Instruments GPIB
driver, the setting "Disable Auto Serial Poll" must be changed to "yes" by means of IBCONF.
REM ---- Example of initialization of the SRQ in the case of errors ------
CALL IBWRT(generatot%, "*CLS") 'Reset status reporting system
CALL IBWRT(generator%,"*SRE 168") 'Permit service request for STAT:OPER-,
'STAT:QUES- and ESR register
CALL IBWRT(generator%,"*ESE 60") 'Set event-enable bit for command, exe-
'cution, device-dependent and query error
ON PEN GOSUB Srq 'Initialization of the service
'request routine
PEN ON
REM Continue main program here
STOP 'End of program
A service request is then processed in the service request routine.
Note: The variables userN% and userM% must be pre-assigned usefully.
Srq:
REM ------------ Service request routine -----------
DO
SRQFOUND% = 0
FOR I% = userN% TO userM% 'Poll all bus users
ON ERROR GOTO nouser 'No user existing
CALL IBRSP(I%, STB%) 'Serial poll, read status byte
IF STB% > 0 THEN 'This instrument has bits set
'in the STB
SRQFOUND% = 1
IF (STB% AND 16) > 0 THEN GOSUB Outputqueue
IF (STB% AND 4) > 0 THEN GOSUB Failure
IF (STB% AND 32) > 0 THEN GOSUB Esrread
END IF
nouser:
NEXT I%
LOOP UNTIL SRQFOUND% = 0
ON ERROR GOTO error handling
ON PEN GOSUB Srq: RETURN 'Enable SRQ routine again;
'End of SRQ routine