Remote Control
R&S
®
FSPN
522
User Manual 1179.4363.02 ─ 01
From the time the viWaitOnEvent() function is called until the occurrence of the expec-
ted event, it does not allow the program to respond to mouse clicks or key entries dur-
ing 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
'--------- Sweep in first Spectrum Tab and query marker --------------------
Dim Status = mbSession.WaitOnEvent( _
MessageBasedSessionEventType.ServiceRequest, SRQWaitTimeout)
'Wait for service request user inputs are not possible
'during the waiting time!
If (Status.EventType() = MessageBasedSessionEventType.ServiceRequest) Then
'If SRQ is recognized => subroutine for evaluation
Srq()
End If
Non-blocking (user inputs possible):
This method is recommended if the waiting time until the event to be signaled by an
SRQ is long (longer than the selected timeout), and user inputs should be possible dur-
ing 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 regu-
lar 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 oper-
ating system for a selectable waiting time (see section
), 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
If (status = VI_SUCCESS) Then
Programming Examples