14.06.2014 Views

Operating Manual EMI TEST RECEIVER ESIB7 - Rohde & Schwarz

Operating Manual EMI TEST RECEIVER ESIB7 - Rohde & Schwarz

Operating Manual EMI TEST RECEIVER ESIB7 - 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.

ESIB<br />

Programming Examples<br />

Visual Basic for Applications (Winword and Excel)<br />

Programming hints:<br />

The programming language Visual Basic for Applications (VBA) is supported as a macro language by<br />

various manufacturers. The programs Winword and Excel use this language for the versions Winword<br />

97 or Excel 5.0 and higher.<br />

For macros created with Visual Basic for Applications, the same hints are valid as for Visual Basic<br />

Applications.<br />

Programming example:<br />

• Using the macro QueryMaxPeak a single sweep with subsequent query of the maximum peak is<br />

performed. The result is entered in a Winword or Excel document.<br />

Sub QueryMaxPeak()<br />

End Sub<br />

Dim ibsta As Integer ’ Status variable<br />

Dim iberr As Integer ’ Error variable<br />

Dim ibcntl As Long ’ transferred characters<br />

Dim ud As Integer ’ Unit Descriptor (handle)for instrument<br />

Dim Response As String ’ Response string<br />

’ Set up connection to measuring instrument<br />

ud = RSDLLibfind("89.10.38.97", ibsta, iberr, ibcntl)<br />

If (ud < 0) Then<br />

Call MsgBox("Device with address 89.10.38.97 could" & _<br />

"not be found", vbExclamation)<br />

End<br />

End If<br />

’ Determine maximum peak in the range 1-2MHZ<br />

Call RSDLLibwrt(ud, "*RST", ibsta, iberr, ibcntl)<br />

Call RSDLLibwrt(ud, "INIT:CONT OFF", ibsta, iberr, ibcntl)<br />

Call RSDLLibwrt(ud, "FREQ:START 1MHZ", ibsta, iberr, ibcntl)<br />

Call RSDLLibwrt(ud, "FREQ:STOP 2MHZ", ibsta, iberr, ibcntl)<br />

Call RSDLLibwrt(ud, "INIT:IMM;*WAI", ibsta, iberr, ibcntl)<br />

Call RSDLLibwrt(ud, "CALC:MARK:MAX;Y?", ibsta, iberr, ibcntl)<br />

Response = Space$(100)<br />

Call RSDLLibrd(ud, Response, ibsta, iberr, ibcntl)<br />

Response = RTrim(Response) ’ Cut off space<br />

’ Insert value in current document (Winword)<br />

Selection.InsertBefore (Response)<br />

Selection.Collapse (wdCollapseEnd)<br />

’ Terminate connection to measuring instrument<br />

Call RSDLLibonl(ud, 0, ibsta, iberr, ibcntl)<br />

The entry of the peak value in the Winword document can be replaced as follows for Excel:<br />

’ Insert value in current document (Excel)<br />

ActiveCell.FormulaR1C1 = Response<br />

1088.7531.12 7.9 E-16

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

Saved successfully!

Ooh no, something went wrong!