Operating instructions

Basic Steps of IEC/IEEE-Bus Programming R&S ESCI
1166.6004.12 7.8 E-1
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 WaitSRQ() 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 causes program abort 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 with triggered measurements.
The following function calls are required:
CALL WaitSRQ(boardID%,result%) 'Wait for service request
'User inputs are not possible
'during the waiting time!
IF (result% = 1) 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 or Mouse"), so
enabling user inputs during the waiting time.
result% = 0
For i = 1 To 10 'Abort after max. 10 loop
'iterations
CALL TestSRQ(boardID%,result%) 'Check service request line
If (result% <> 0) Then
CALL Srq 'If SRQ is recognized =>
'subroutine for evaluation
Else
Call Hold(20) 'Call hold function with
'20 ms waiting time.
'User inputs are possible.
Endif
Next i
If result% = 0 Then
PRINT "Timeout Error; Program aborted"' Output error message
STOP 'Stop software
Endif