6146/6156 DC Voltage/Current Generators Operation Manual
5.9.3 Program Example 2-Memory Setting, Scan Operation and Voltage/Source Measurement
5-58
Call aUSBWrt(lngDMMHdl, "C,*RST")
' VIG setting
Call aUSBWrt(lngVIGHdl, "MD4") ' Memory recall mode
Call aUSBWrt(lngVIGHdl, "RCLR") ' Initializes the memory.
' Memory setting
dblGParam = dblVMin ' Sets the start (stop) voltage.
Do
' Creates and sends the memory setting parameter.
strSendCmd = "N" & CStr(intMemNo) & ",SOV" & CStr(dblGParam) & "V,P"
Call aUSBWrt(lngVIGHdl, strSendCmd)
If blnMemNoDec = False Then ' Decrement or not?
dblGParam = dblGParam + dblVStep ' Adds the step value to the current value.
Else
dblGParam = dblGParam - dblVStep ' Subtracts the step value from the current value.
End If
If dblGParam >= dblVMax Then ' Exceeds the peak (maximum) voltage?
blnMemNoDec = True ' Switches to decrement.
dblGParam = dblVMax - dblVStep ' Sets the next value to the peak.
End If
intMemNo = intMemNo + 1 ' Increments the memory number
If blnUSBComErr = True Then ' USB error check
GoTo ErrExit
End If
Loop Until dblGParam < dblVMin And blnMemNoDec = True
' until voltage falls below the minimum value
Call aUSBWrt(lngVIGHdl, "SCM0") ' Sets the scan mode to hold.
Call aUSBWrt(lngVIGHdl, "SC0," & CStr(intMemNo - 1))
' Scan range (0 to stop number)
Call aUSBWrt(lngVIGHdl, "*CLS") ' Status clear
' DMM setting
Call aUSBWrt(lngDMMHdl, "F1") ' DC voltage measurement function
Call aUSBWrt(lngDMMHdl, "PR2") ' Sets the sampling rate to Middle.
Call aUSBWrt(lngDMMHdl, "TRS3") ' Sets the trigger to BUS.
Call aUSBWrt(lngDMMHdl, "H0") ' Header OFF
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"