Specifications

272 Chapter 16
Application Programs
Basic Measurement
2460|
2470| Function Message(Mes As String) As Integer
2480|
2490| Dim Inp_char As Integer
2500|
2510| Inp_char = MsgBox(Mes, vbYesNo + vbQuestion, "Impedance
measurement")
2520|
2530| If Inp_char = vbYes Then
2540| Message = 0
2550| Else
2560| Message = -1
2570| End If
2580|
2590| End Function
Example 16-3 Measuring the self-resonant point of an inductor (bsc_meas.cls)
When using the event provided in the E4991A, the following programing steps are created.
Public WithEvents event variable As E4991ALib.Application
Private Sub event variable_Event ( )
~
End Sub
The details of the program (bsc_meas.cls) are explained below. The line numbers are added
for explanatory purposes but are not usually displayed.
Line 20 Defines the variable (Evnt) as the Public type so that the event
procedure can be used in different procedures.
Lines 40 - 90 Terminates the program when a “PLL unlock” error occurs inside the
E4991A.
Lines 110 - 160 Terminates the program when a “DC bias overload” error occurs
inside the E4991A.
Lines 180 - 230 Forces the program to end when an “RF overload” error occurs inside
the E4991A.
10|
20| Public WithEvents Evnt As E4991ALib.Application
30|
40| Private Sub Evnt_Unlocked()
50|
60| MsgBox "Error: PLL Unlock" & vbCrLf & vbCrLf & "Program interruption", vbExclamation,
"E4991A Internal Error"
70| End
80|
90| End Sub
100|
110| Private Sub Evnt_DcBiasOverload()
120|
130| MsgBox "Error: Dc bias overload" & vbCrLf & vbCrLf & "Program interruption",
vbExclamation, "E4991A Internal Error"
140| End