6146/6156 DC Voltage/Current Generators Operation Manual
5.9.3 Program Example 2-Memory Setting, Scan Operation and Voltage/Source Measurement
5-55
Call gpibwrt(intVIGDes, "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 gpibwrt(intVIGDes, 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.
Loop Until dblGParam < dblVMin And blnMemNoDec = True
' Until voltage falls below the minimum value
Call gpibwrt(intVIGDes, "SCM0") ' Sets the scan mode to hold.
Call gpibwrt(intVIGDes, "SC0," & CStr(intMemNo - 1))
' Scan range (0 to stop number)
Call gpibwrt(intVIGDes, "*CLS") ' Status clear
' DMM setting
Call gpibwrt(intDMMDes, "F1") ' DC voltage measurement function
Call gpibwrt(intDMMDes, "PR2") ' Sets the sampling rate to Middle.
Call gpibwrt(intDMMDes, "TRS3") ' Sets the trigger to BUS.
Call gpibwrt(intDMMDes, "H0") ' Header OFF
Call gpibwrt(intDMMDes, "*CLS") ' Status clear
Call gpibwrt(intVIGDes, "OPR") ' Sets the VIG output to ON.
For intNowRepCnt = 1 To intRepSet Step 1 ' Repeats the specified number of times.
Do
' VIG source and check
Call gpibwrt(intVIGDes, "DSR?") ' DSR query
Call gpibrd(intVIGDes, strRecvStr) ' Data reception
lngVIGDSR = CLng(strRecvStr) ' DSR value storing
'AND operation on the each function bit of DSR
blnRDYb = lngVIGDSR And 1024 ' READY Out bit
blnSWEb = lngVIGDSR And 8192 ' Sweep End bit
If blnRDYb = True Then ' VIG Ready
Call gpibwrt(intVIGDes, "RCLM?") ' Query of the current memory number
Call gpibrd(intVIGDes, strRecvStr) ' Data reception
' Extracts the memory number character string.
intNowMemNo = CInt(Replace(strRecvStr, "RCLM", ""))
Call gpibrd(intVIGDes, 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 gpibwrt(intDMMDes, "*TRG") ' Sends the trigger and starts measurement.
Do