6241A/6242 DC Voltage Current Source/Monitor Operation Manual
6.8.1 Programming Examples with GPIB
6-44
6.8.1.3 Programming Example 3: Sweep Measurement
End Sub
(Output example)
DI +2.00000E-03
DI +2.50000E-03
DI +1.00000E-03
DI +0.50000E-03
Option Explicit ’ Explicit declaration for all variables
Private Sub Sampl3_GPIB_Click() ’ Event procedure for the command button
Dim board As Integer ’ GPIB board address
Dim pad As Integer ’ 6241A/6242 address
Dim vig As Integer ’ 6241A/6242 device descriptor
Dim dt As String*20 ’ Data reception buffer
Dim s As Integer ’ Serial poll results storage variable
Dim rowNum As Integer ’ Cell number
board = 0 ’ GPIB board address 0
pad = 1 ’ 6241A/6242 address 1
Call ibdev(board,pad,0,T10s,1,0,vig) ’ Opening and initializing device (6241A/6242) (time out 10 s)
Call ibconfig(vig,IbcUnAddr,1) ’ Address setting performed for each transmission or reception
Call SUBsend(vig, "C,*RST" & vbLf) ’ DCL and parameter Initialization
Call SUBsend(vig, "*CLS" & vbLf) ’ Status byte initialization
Call SUBsend(vig, "*SRE8" & vbLf) ’ Setting bit3 for the Service Request Enable Register to 1
Call SUBsend(vig, "DSE8192" & vbLf) ’ Setting bit13 for the Device Event Enable Register to 1
Call SUBsend(vig, "S0" & vbLf) ’ SRQ transmission mode
’ Register setting for transmitting SRQ following completion of
Sweep
Call SUBsend(vig, "OH1" & vbLf) ’ Header ON
Call SUBsend(vig,"VF" & vbLf) ’ Voltage source function
Call SUBsend(vig, "F2" & vbLf) ’ Current measurement function
Call SUBsend(vig, "MD2" & vbLf) ’ Sweep source mode
Call SUBsend(vig, "SN0.5,5,0.5" & vbLf) ’ Linear Sweep: Start 0.5 V, stop 5 V, and step 0.5 V
Call SUBsend(vig, "SB0" & vbLf) ’ Sweep bias value 0 V
Call SUBsend(vig, "SP3,4,100" & vbLf) ’ Hold time 3 ms, Measurement delay time 4 ms
’ Period: 100 ms
Call SUBsend(vig, "LMI0.03" & vbLf) ’ Limiter value: 30 mA
Call SUBsend(vig, "ST1,RL" & vbLf) ’ Storing Measured Data into Data Memory (Memory Store)
ON, Clearing Saved Data (Memory Clear)
Call SUBsend (vig, "OPR" & vbLf) ’ Output ON
Call SUBsend(vig, "*TRG" & vbLf) ’ Starting Sweep
’ Waiting for Sweep measurement completing
Call ibwait(vig,RQS Or TIMO) ’ Waiting for SRQ transmission
If (ibsta And TIMO) Then ’ In case of time out
Call MsgBox("SRQ Time Out",vbOKOnly,"Error")
’ Indicating error
Else ’ If no timeout
Call ibrsp(vig,s) ’ Executing serial poll
End If ’ Ending If