Example 1, Acquire Trace - Agilent Technologies 86082A User Manual

Wavelength domain component analyzer
Table of Contents

Advertisement

Remote Operation
Example Programs

Example 1, Acquire Trace

Description
This program demonstrates how to use Visual Basic to take a measurement
and download a trace in ASCII format. The program also demonstrates how to
change several settings such as center wavelength, span, and input receiver
channel. It should be noted that the settings are not sent to the instrument
until the Acquire Trace button is pressed.
Program
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Const OPC_TMO = 180
Private Const LZ_TMO = 360
Private Sub cmdAcquireTrace_Click()
Dim TimeStart As Double
'-- VISA session variables
Dim DefRM As Long
Dim DevSessionNum As Long
Dim ReadBuffer As String * 65500
Dim STB As Integer
Dim Status As Long: Status = 0
Dim ErrMsg As String: ErrMsg = ""
On Error GoTo ErrorHandler
MousePointer = vbHourglass
'-- Create a VISA session
Status = viOpenDefaultRM(DefRM)
If Status <> 0 Then GoTo ErrorHandler
'-- Open a session to the WDCA
Status = viOpen(DefRM, "GPIB" & txtGPIB_IN.Text & "::" & txtGPIB_PA.Text, 0, 0, DevSessionNum)
If Status <> 0 Then GoTo ErrorHandler
'-- Clear the instrument
Status = viClear(DevSessionNum)
If Status <> 0 Then GoTo ErrorHandler
'-- Set write buffer to flush on access
Status = viSetAttribute(DevSessionNum, VI_ATTR_WR_BUF_OPER_MODE, VI_FLUSH_ON_ACCESS)
If Status <> 0 Then GoTo ErrorHandler
'-- Set read buffer to flush on access
Status = viSetAttribute(DevSessionNum, VI_ATTR_RD_BUF_OPER_MODE, VI_FLUSH_ON_ACCESS)
If Status <> 0 Then GoTo ErrorHandler
'-- Clear status registers
Status = viVPrintf(DevSessionNum, "*CLS" & Chr$(10), 0)
If Status <> 0 Then GoTo ErrorHandler
5-34
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
'VISA session
'VISA session to device
'Buffer to read back data
'Status byte

Advertisement

Table of Contents
loading

Table of Contents