Agilent Technologies 86082A User Manual page 254

Wavelength domain component analyzer
Table of Contents

Advertisement

Private Function InitVISASession(ByVal GPIB_IN As String, ByVal GPIB_PA As String, _
'-- VISA session variables
Dim ReadBuffer As String * 65500
Dim Status As Long: Status = 0
On Error GoTo ErrorHandler
'-- Create a VISA session
Status = viOpenDefaultRM(DefRM)
If Status <> 0 Then GoTo ErrorHandler
'-- Open a session to the WDCA
Status = viOpen(DefRM, "GPIB" & GPIB_IN & "::" & GPIB_PA, 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
'-- Ensure that the instrument isn't in repeat sweep mode
Status = viVPrintf(DevSessionNum, "INIT:CONT 0" & Chr$(10), 0)
If Status <> 0 Then GoTo ErrorHandler
'-- Clear status registers
Status = viVPrintf(DevSessionNum, "*CLS" & Chr$(10), 0)
If Status <> 0 Then GoTo ErrorHandler
'-- Map OPC to bit 5 of the Standard Event Status Enable Register
Status = viVPrintf(DevSessionNum, "*ESE 1" & Chr$(10), 0)
If Status <> 0 Then GoTo ErrorHandler
'-- Check for Lambda Zero
Status = CheckLambdaZero(DevSessionNum, ErrMsg)
If Status <> 0 Then GoTo ErrorHandler
'-- Format data as ASCII
Status = viVPrintf(DevSessionNum, "FORM:DATA ASCII" & Chr$(10), 0)
If Status <> 0 Then GoTo ErrorHandler
Status = 0
ErrMsg = ""
Exit Function
ErrorHandler:
If Err.Number = 0 Then
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
DefRM As Long, DevSessionNum As Long, _
Optional ErrMsg As String = "") As Long
Remote Operation
Example Programs
'Buffer to read back data
5-79

Advertisement

Table of Contents
loading

Table of Contents