6146/6156 DC Voltage/Current Generators Operation Manual
5.9.2 Program Example 1-DC Voltage Source and Voltage/Current Measurement
5-52
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 compete.
Call aUSBRd(lngDMMHdl, strRecvStr) ' Receives the measured data.
' Assigns the measured data to the specified cell.
ActiveSheet.Cells(lngStaRow, lngVDataCol).Value = strRecvStr
Call aUSBWrt(lngDMMHdl, "F5") ' 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 compete.
Call aUSBRd(lngDMMHdl, strRecvStr) ' Receives the measured data.
' Assigns the measured data to the specified cell.
ActiveSheet.Cells(lngStaRow, lngIDataCol).Value = strRecvStr
ErrExit:
Call aUSBWrt(lngVIGHdl, "SBY") ' Sets the VIG output ot OFF
' Closes the devices (instruments).
Call aUSBCls(lngVIGHdl) ' VIG
Call aUSBCls(lngDMMHdl) ' DMM
' The USB driver terminates.
Call aUSBEnd
End Sub