6146/6156 DC Voltage/Current Generators Operation Manual
5.9.3 Program Example 2-Memory Setting, Scan Operation and Voltage/Source Measurement
5-59
Call aUSBWrt(lngVIGHdl, "OPR") ' Sets the VIG output to ON.
For intNowRepCnt = 1 To intRepSet Step 1
Do
' VIG source and check
Call aUSBWrt(lngVIGHdl, "DSR?") ' DSR query
Call aUSBRd(lngVIGHdl, strRecvStr) ' Data reception
lngVIGDSR = CLng(strRecvStr) ' DSR value storing
' AND operation on each function bit of DSR
blnRDYb = lngVIGDSR And 1024 ' READY OUT bit
blnSWEb = lngVIGDSR And 8192 ' Sweep End bit
If blnUSBComErr = True Then ' USB error check
GoTo ErrExit
End If
If blnRDYb = True Then ' VIG Ready
Call aUSBWrt(lngVIGHdl, "RCLM?") ' Query of the current memory number
Call aUSBRd(lngVIGHdl, strRecvStr) ' Data reception
' Extracts the memory number character string.
intNowMemNo = CInt(Replace(strRecvStr, "RCLM", ""))
Call aUSBRd(lngVIGHdl, strRecvStr) ' Receives the voltage source value.
strRecvStr = Replace(strRecvStr, "SOV", "")
' Stores the memory number and the source parameter on the sheet.
ActiveSheet.Cells(lngRowNo, lngRepCntCol).Value = intNowRepCnt
ActiveSheet.Cells(lngRowNo, lngMemNoCol).Value = intNowMemNo
ActiveSheet.Cells(lngRowNo, lngGenerateVCol).Value = strRecvStr
' DMM measurement operation
lngMeasCnt = lngMeasCnt + 1 ' Increments the number of measurement
Call aUSBWrt(lngDMMHdl, "*TRG") ' Sends the trigger and starts measurement.
Do
Call aUSBWrt(lngDMMHdl, "*STB?") ' STB query
Call aUSBRd(lngDMMHdl, strRecvStr) ' Data reception
lngDMMSTB = CLng(strRecvStr) ' STB value storing
lngDMMSTB = lngDMMSTB And 16 ' AND operation on the Message Available bit
If blnUSBComErr = True Then ' USB error check
GoTo ErrExit
End If
Loop Until lngDMMSTB = 16 ' Repeats until the measurement is complete.
Call aUSBRd(lngDMMHdl, strRecvStr) ' Receives the measured value.
' Stores the voltage measured data on the sheet.
ActiveSheet.Cells(lngRowNo, lngVDataCol).Value = strRecvStr
Call aUSBWrt(lngDMMHdl, "F5") ' DC current measurement function
Call aUSBWrt(lngDMMHdl, "*TRG") ' Sends the trigger and starts measurement.
Do
Call aUSBWrt(lngDMMHdl, "*STB?") ' STB query
Call aUSBRd(lngDMMHdl, strRecvStr) ' Data reception
lngDMMSTB = CLng(strRecvStr) ' STB value storing
lngDMMSTB = lngDMMSTB And 16 ' AND operation on the Message Available bit
If blnUSBComErr = True Then ' USB error check
GoTo ErrExit
End If
Loop Until lngDMMSTB = 16 ' Repeats until the measurement is complete.
Call aUSBRd(lngDMMHdl, strRecvStr) ' Receives the measured value.
' Stores the number of measurement and the current measured data on the sheet.