18.12.2012 Views

R&S FSQ Signal Analyzer - Rohde & Schwarz

R&S FSQ Signal Analyzer - Rohde & Schwarz

R&S FSQ Signal Analyzer - Rohde & Schwarz

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

R&S <strong>FSQ</strong> Remote Control – Programming Examples<br />

Non-blocking (user inputs possible)<br />

Basic Programming Steps for the VISA Interface<br />

This method is recommended if the waiting time until the event to be signalled by an<br />

SRQ is long (longer than the selected time-out), and user inputs should be possible<br />

during the waiting time, or if the event is not certain to occur. This method is, therefore,<br />

the preferable choice for waiting for the end of measurements, i.e. the output of<br />

results, especially in the case of triggered measurements.<br />

The method necessitates a waiting loop that checks the status of the SRQ line at<br />

regular intervals and returns control to the operating system during the time the<br />

expected event has not yet occurred. In this way, the system can respond to user<br />

inputs (mouse clicks, key entries) during the waiting time.<br />

A query of the VI_ATTR_GPIB_SRQ_STATE attribute can only be sent from the<br />

controller, not from the instrument. Therefore, the handle of the controller board is<br />

used for this calling of the viGetAttribute attribute.<br />

It is advisable to employ the Hold() auxiliary function, which returns control to the<br />

operating system for a selectable waiting time (see section “Waiting Without Blocking<br />

the Keyboard and Mouse” on page 7.4), so enabling user inputs during the waiting<br />

time.<br />

result% = 0<br />

For i = 1 To 10<br />

'Abort after max. 10 loop iterations<br />

Call viGetAttribute(board, VI_ATTR_GPIB_SRQ_STATE, result%)<br />

'Check service request line<br />

If (result% 0) Then<br />

CALL Srq<br />

'If SRQ is recognized => subroutine for evaluation<br />

Else<br />

CALL Hold(20)<br />

'Call hold function with 20 ms waiting time.<br />

'User inputs are possible.<br />

Endif<br />

Next i<br />

If result% = 0 Then<br />

PRINT "Timeout Error; Program aborted"<br />

'Output error message<br />

STOP<br />

'Stop software<br />

Endif<br />

7.2.1.3 Waiting Without Blocking the Keyboard and Mouse<br />

A frequent problem with remote control programs using Visual Basic is to insert waiting<br />

times without blocking the keyboard and the mouse.<br />

If the program is to respond to user inputs also during a waiting time, control over<br />

the program events during this time must be returned to the operating system. In<br />

Visual Basic, this is done by calling the DoEvents function. This function causes keyboard-<br />

or mouse-triggered events to be executed by the associated elements. For<br />

example, it allows the operation of buttons and input fields while the user waits for<br />

an instrument setting to be completed.<br />

7.4 Operating Manual 1313.9681.12 - 01

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!