Agilent Technologies 86082A User Manual page 228

Wavelength domain component analyzer
Table of Contents

Advertisement

'-- 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
'-- Translate error number into a message
Call viStatusDesc(DevSessionNum, Status, ReadBuffer)
'-- Trim off nulls
ErrMsg = TrimVISAStr(ReadBuffer)
InitVISASession = Status
Else
ErrMsg = Err.Number & vbCrLf & Err.Description
End If
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Remote Operation
Example Programs
5-53

Advertisement

Table of Contents
loading

Table of Contents