Example 2: Control From Excel - Agilent Technologies 86038B User Manual

Photonic dispersion and loss analyzer
Table of Contents

Advertisement

Example 2: Control from Excel

Complete Source Code
200
Option Explicit
Private WithEvents m_PDLARemoteControl As RemoteClient.Communicator
Public Sub initPdlaLink()
Set m_PDLARemoteControl = New RemoteClient.Communicator
End Sub
Public Sub closePdlaLink()
m_PDLARemoteControl.Connectivity.Disconnect
End Sub
Private Sub GoButton_Click()
' Clear the previous data
Sheet1.Cells(9, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Clear
If Sheet1.ChartObjects.Count > 0 Then
Sheet1.ChartObjects(1).Delete ' Delete last chart
End If
' Open session
m_PDLARemoteControl.Connectivity.Connect (PDLA_ID_Box.Value)
' Wait for PDLA connection to come alive
DoEvents
Application.Wait (Now + TimeValue("0:00:01"))
DoEvents
While m_PDLARemoteControl.Connectivity.IsConnected = False
Application.Wait (Now + TimeValue("0:00:01"))
DoEvents
Wend
' Read x axis info
Dim XStart As Double
Dim xinc As Double
Dim XData() As Double
XStart = m_PDLARemoteControl.Results.XStart(eMeasurementType_Gain)
xinc = m_PDLARemoteControl.Results.Increment
'Get CD Data - Port One
Dim GDData() As Double
GDData = m_PDLARemoteControl.Results.YData(eMeasurementType_GD,
eODAPort_One)
'Get Gain Data - Port One
Dim GainData() As Double
GainData = m_PDLARemoteControl.Results.YData(eMeasurementType_Gain,
eODAPort_One)
' close session
m_PDLARemoteControl.Connectivity.Disconnect
Agilent 86038B Photonic Dispersion and Loss Analyzer, Second Edition

Advertisement

Table of Contents
loading

Table of Contents