6146/6156 DC Voltage/Current Generators Operation Manual
5.9.2 Program Example 1-DC Voltage Source and Voltage/Current Measurement
5-51
GoTo ErrExit
End If
' Device clear and parameter initialization
Call aUSBWrt(lngVIGHdl, "C,*RST")
Call aUSBWrt(lngDMMHdl, "C,*RST")
' VIG setting
Call aUSBWrt(lngVIGHdl, "VF") ' Voltage source function
Call aUSBWrt(lngVIGHdl, "SOV+5V") ' Sets the source voltage to 5 V. (auto range)
Call aUSBWrt(lngVIGHdl, "*CLS") ' Status clear
' DMM setting
Call aUSBWrt(lngDMMHdl, "F1") ' Voltage measurement function
Call aUSBWrt(lngDMMHdl, "PR3") ' Sets the sampling rate to SLOW1.
Call aUSBWrt(lngDMMHdl, "TRS3") ' Sets the trigger to BUS.
Call aUSBWrt(lngDMMHdl, "H1") ' Header ON
Call aUSBWrt(lngDMMHdl, "*CLS") ' Status clear
' Waits until the VIG setting operation is complete.
Do
Call aUSBWrt(lngVIGHdl, "*OPC?") ' All the operation is complete?
Call aUSBRd(lngVIGHdl, strRecvStr) ' Data reception
' Checks for errors in USB transmission and reception.
If blnUSBComErr = True Then
GoTo ErrExit
End If
Loop Until strRecvStr = "1"
' Waits until the DMM setting operation is complete.
Do
Call aUSBWrt(lngDMMHdl, "*OPC?") ' All the operation is complete?
Call aUSBRd(lngDMMHdl, strRecvStr) ' Data reception
' Checks for errors in USB transmission and reception.
If blnUSBComErr = True Then
GoTo ErrExit
End If
Loop Until strRecvStr = "1"
' VIG operation
Call aUSBWrt(lngVIGHdl, "OPR") ' Sets the VIG output to ON.
Do
Call aUSBWrt(lngVIGHdl, "DSR?") ' DSR query
Call aUSBRd(lngVIGHdl, strRecvStr) ' Data reception
lngVIGDSR = CLng(strRecvStr) ' DSR value storing
lngVIGDSR = lngVIGDSR And 1024 ' AND operation on the READY OUT bit
If blnUSBComErr = True Then ' Checks for errors in USB transmission and reception.
GoTo ErrExit
End If
Loop Until lngVIGDSR = 1024 ' Waits until the READY OUT bit is set.
' DMM operation
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