R&S ESU Remote Control – Programming Examples
Basic Programming Steps for the VISA Interface
7.6 Operating Manual 1302.6163.12 - 03
7.2.1.4 Service Request Routine
A service request is processed in the service request routine.
REM ------------ Service request routine ----------------------------------
Public SUB Srq()
ON ERROR GOTO noDevice
'No user existing
Call viReadSTB(analyzer, 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 CALL Outputqueue
IF (STB% AND 4) > 0 THEN CALL ErrorQueueHandler
IF (STB% AND 8) > 0 THEN CALL Questionablestatus
IF (STB% AND 128) > 0 THEN CALL Operationstatus
IF (STB% AND 32) > 0 THEN CALL Esrread
END IF
noDevice:
END SUB
REM ***********************************************************************
Reading out the status event registers, the output buffer and the error/event queue
is effected in subroutines.
7.2.1.5 Evaluation of SCPI Status Registers
REM ------ Subroutine for evaluating Questionable Status Register ---------
Public SUB Questionablestatus()
Ques$ = SPACE$(20)
'Preallocate blanks to text variable
status = viWrite(analyzer, "STATus:QUEStionable:EVENt?", 26, retCnt)
status = viRead(analyzer, Ques$, 20, retCnt)
PRINT "Questionable Status: "; Ques$
END SUB
REM
***********************************************************************
REM ------ Subroutine for evaluating Operation Status Register ------------
Public SUB Operationstatus()
Oper$ = SPACE$(20)
'Preallocate blanks to text variable
status = viWrite(analyzer, "STATus:OPERation:EVENt?", 23, retCnt)
status = viRead(analyzer, Oper$, 20, retCnt)
PRINT "Operation Status: "; Oper$
END SUB
REM
***********************************************************************