Service Request R&S FSL
1300.2519.12 7.2 E-11
CALL viEnableEvent(analyzer, VI_EVENT_SERVICE_REQ, VI_QUEUE, 0)
'Enable the event for service
'request
Status = viWaitOnEvent(analyzer, VI_EVENT_SERVICE_REQ, SRQWaitTimeout,
VI_NULL, VI_NULL)
IF (status = VI_SUCCESS) THEN CALL Srq 'If SRQ is recognized =>
'subroutine for evaluation
END SUB
REM ***********************************************************************
Waiting for the Arrival of a Service Request
There are basically two methods of waiting for the arrival of a service request:
1. Blocking (user inputs not possible):
This method is appropriate if the waiting time until the event to be signalled by an SRQ is short
(shorter than the selected timeout), if no response to user inputs is required during the waiting time,
and if – as the main criterion – the event is absolutely certain to occur.
Reason:
From the time the viWaitOnEvent() function is called until the occurrence of the expected event, it
does not allow the program to respond to mouse clicks or key entries during the waiting time.
Moreover, it returns an error if the SRQ event does not occur within the predefined timeout period.
The method is, therefore, in many cases not suitable for waiting for measurement results,
especially when using triggered measurements.
The following function calls are required:
Status = viWaitOnEvent(analyzer, VI_EVENT_SERVICE_REQ, SRQWaitTimeout,
VI_NULL, VI_NULL)
'Wait for service request user
'inputs are not possible during
'the waiting time!
IF (status = VI_SUCCESS) THEN CALL Srq
'If SRQ is recognized =>
'subroutine for evaluation
2. Non–blocking (user inputs possible):
This method is recommended if the waiting time until the event to be signalled by an SRQ is long
(longer than the selected timeout), and user inputs should be possible during the waiting time, or if
the event is not certain to occur. This method is, therefore, the preferable choice for waiting for the
end of measurements, i.e. the output of results, especially in the case of triggered measurements.
The method necessitates a waiting loop that checks the status of the SRQ line at regular intervals
and returns control to the operating system during the time the expected event has not yet
occurred. In this way, the system can respond to user inputs (mouse clicks, key entries) during the
waiting time.
It is advisable to employ the Hold() auxiliary function, which returns control to the operating system
for a selectable waiting time (see section "Waiting Without Blocking the Keyboard and Mouse"), so
enabling user inputs during the waiting time.
result% = 0
For i = 1 To 10 'Abort after max. 10 loop
'iterations
Status = viWaitOnEvent(analyzer, VI_EVENT_SERVICE_REQ,
VI_TMO_IMMEDIATE, VI_NULL,
VI_NULL)
'Check event queue