6146/6156 DC Voltage/Current Generators Operation Manual
5.9.4 Program Example 3-Sweep Operation and Voltage/Current Measurement
5-67
If blnLMHb = True Then ' Checks for the HI limiter.
strSrcLimit = "LMH"
End If
If blnLMLb = True Then ' Checks for the LO limiter.
strSrcLimit = strSrcLimit & "LML"
End If
If blnRDYb = True Then
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 ' Checks for errors in USB transmission and reception.
GoTo ErrExit
End If
Loop Until lngDMMSTB = 16 ' Repeats until the measurement is complete.
Call aUSBRd(lngDMMHdl, strMeasVData) ' Receives the DMM measured value.
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 ' Checks for errors in USB transmission and reception.
GoTo ErrExit
End If
Loop Until lngDMMSTB = 16 ' Repeats until the measurement is complete.
Call aUSBRd(lngDMMHdl, strMeasIData) ' Receives the DMM measured value.
Call aUSBRd(lngVIGHdl, strSrcData) ' Receives the current VIG source value.
strSrcData = Replace(strSrcData, "SOV", "") ' Deletes the header character string.
' Stores data on the sheet.
With ActiveSheet
.Cells(lngRowNo, lngMeaNoCol).Value = lngMeasCnt
.Cells(lngRowNo, lngSrcLimitCol).Value = strSrcLimit
.Cells(lngRowNo, lngSrcDataCol).Value = strSrcData
.Cells(lngRowNo, lngVDataCol).Value = strMeasVData
.Cells(lngRowNo, lngIDataCol).Value = strMeasIData
End With
strSrcLimit = ""
Call aUSBWrt(lngDMMHdl, "F1") ' DC voltage measurement function
lngRowNo = lngRowNo + 1 ' Increments the row number.
End If
DoEvents ' Turns over the control to OS temporarily.
Loop Until blnSWEb = True ' Repeats until the Sweep End bit is set.
ErrExit: