Planar R54 Programming Manual page 222

Vector reflectometer; programming com/dcom
Table of Contents

Advertisement

Example 2. Checking the Instrument Ready State
Normally, the user control program starts when the PlanarR54x2.exe application is
running, the instrument booting is completed, and the instrument is ready for use. In
some cases, it is recommended to check if the instrument is ready for use. The
instrument may be not ready for use if it is not connected to PC via USB cable.
Moreover, if the PlanarR54x2.exe application has not been started in advance, the
CreateObject function will automatically start the application and then within about 10
seconds the instrument booting will be in progress. The instrument will not be ready for
use until the booting is completed. The Ready property is used to check if the
instrument is ready for use.
The following program checks the Ready property right after a COM object has been
created. If the PlanarR54x2.exe application has been started in advance and the booting
is completed, "Analyzer is ready" will be displayed. If the Ready property value is
False, 10 second delay is activated for the case the PlanarR54x2.exe application has
been started by the COM object creation. In 10 seconds the program rechecks the Ready
property. If the value is True, "Analyzer is ready" will be displayed, if otherwise,
"Analyzer is not ready" will be displayed, what means the instrument is not connected
to LAN or it is not connected to PC via USB cable.
Dim app As Object
Sub Example2()
Set app = CreateObject("R54x2.Application")
If app.Ready = False Then
Application.Wait (Now + TimeValue("0:00:10"))
If app.Ready = False Then
MsgBox ("Analyzer is not ready")
Exit Sub
End If
End If
MsgBox ("Analyzer is ready")
End Sub
222

Advertisement

Table of Contents
loading

Table of Contents