Agilent Technologies 34970A Switch User Manual


 
Sub OpenPort()
’""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
’ Be sure that the GPIB address has been set in the ’VISAaddr’ variable
’ before calling this routine.
’""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
’ Open the VISA session
errorStatus = viOpenDefaultRM(videfaultRM)
’ Open communications to the instrument
errorStatus = viOpen(videfaultRM, "GPIB0::" & VISAaddr & "::INSTR", 0, 2500, vi)
’ If an error occurs, give a message
If errorStatus < VI_SUCCESS Then
Range("A2").Select
Cells(1, 1) = "Unable to Open Port"
End If
End Sub
Sub ClosePort()
errorStatus = viClose(vi)
’ Close the session
errorStatus = viClose(videfaultRM)
End Sub
’""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
’ This subroutine is used to create delays. The input is in seconds and
’ fractional seconds are allowed.
’""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Sub delay(delay_time As Single)
Dim Finish As Single
Finish = Timer + delay_time
Do
Loop Until Finish <= Timer
End Sub
Chapter 7 Application Programs
Example Programs for Excel 7.0
324