6146/6156 DC Voltage/Current Generators Operation Manual
5.9.3 Program Example 2-Memory Setting, Scan Operation and Voltage/Source Measurement
5-54
5.9.3.1 Program Example Using GPIB
Option Explicit ' Clearly declares all variables.
Private Const intIFBoardAdr As Integer = 0 ' Sets the GPIB board address to 0.
Private Const intVIGAdr As Integer = 1 ' Sets the VIG address to 1.
Private Const intDMMAdr As Integer = 2 ' Sets the DMM address to 2.
' Operation setting parameter
Private Const dblVMin As Double = 0 ' Start (minimum) voltage [V]
Private Const dblVMax As Double = 5 ' Peak (maximum) voltage [V]
Private Const dblVStep As Double = 0.1 ' Voltage step value [V]
Private Const intRepSet As Integer = 2 ' Number of repetition
' Sets the sheet to store data.
Private Const lngStaRow As Long = 1 ' Start row to store data
Private Const lngRepCntCol As Long = 1 ' Column to store the number of repetition
Private Const lngMeasNoCol As Long = 2 ' Column to store the number of measurement
Private Const lngMemNoCol As Long = 3 ' Column to store the memory number
Private Const lngGenerateVCol As Long = 4 ' Column to store the source voltage
Private Const lngVDataCol As Long = 5 ' Column to store the measured voltage
Private Const lngIDataCol As Long = 6 ' Column to store the measured current
Public Sub SetMemAndMeasure_GPIB()
Dim intVIGDes As Integer ' VIG device descriptor
Dim intDMMDes As Integer ' DMM device descriptor
Dim strRecvStr As String ' Received character string
Dim strSendCmd As String ' Memory setting command character string
Dim dblGParam As Double ' Source value parameter
Dim intMemNo As Integer ' Memory number
Dim blnMemNoDec As Boolean ' Peak flag of the setting value
Dim lngVIGDSR As Long ' VIG DSR value
Dim blnRDYb As Boolean ' READY OUT bit
Dim blnSWEb As Boolean ' Sweep End bit
Dim lngDMMSTB As Long ' DMM STB value
Dim lngRowNo As Long ' Row to store the measured data
Dim lngMeasCnt As Long ' Number of measurement
Dim intNowRepCnt As Integer ' Number of repetition
Dim intNowMemNo As Integer ' Current VIG memory number
lngRowNo = lngStaRow ' Start row to store data
' Opens the devices (VIG, DMM) and executes initialization (timeout 10 s).
Call ibdev(intIFBoardAdr, intVIGAdr, 0, T10s, 1, 0, intVIGDes)
Call ibdev(intIFBoardAdr, intDMMAdr, 0, T10s, 1, 0, intDMMDes)
' Sets addresses in each transmission and reception
Call ibconfig(intVIGDes, IbcUnAddr, 1)
Call ibconfig(intDMMDes, IbcUnAddr, 1)
' Clears the devices and initializes parameters.
Call gpibwrt(intVIGDes, "C,*RST")
Call gpibwrt(intDMMDes, "C,*RST")
' VIG setting
Call gpibwrt(intVIGDes, "MD4") ' Memory recall mode