6241A/6242 DC Voltage Current Source/Monitor Operation Manual
6.8.1 Programming Examples with GPIB
6-46
6.8.1.4 Programming Example 4: Using Measurement Buffer Memory
(Example: 100 measurement data items are recalled in the shortest time)
Option Explicit ’ Explicit declaration for all variables
Private Sub Sampl4_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 dt_sz As Integer ’ Number of measurement buffer memory data items
Dim dt_rn(100) As String*20 ’ Measurement buffer memory data storage array variable
Dim i As Integer,s As Integer ’ i: For Loop variable, s: Serial poll result storage variable
board=0 ’ GPIB board address 0
pad = 1 ’ 6241A/6242 address 1
Call ibdev(board,pad,0,T30s,1,0,vig) ’ Opening and initializing device (6241A/6242) (time out 30 s)
Call ibconfig(vig,IbcUnAddr,1) ’ Address setting performed for each transmission or reception
’ Executing Sweep measurement
Call ibwrt(vig, "C,*RST" & vbLf) ’ DCL and parameter Initialization
Call ibwrt(vig, "*CLS" & vbLf) ’ Status byte initialization
Call ibwrt(vig, "*SRE8" & vbLf) ’ Setting bit3 for the Service Request Enable Register to 1.
Call ibwrt(vig, "DSE8192" & vbLf) ’ Setting bit13 for the Device Event Enable Register to 1.
Call ibwrt(vig, "S0" & vbLf) ’ SRQ transmission mode
’ Register setting for transmitting SRQ following completion of
Sweep
Call ibwrt(vig, "VF,F2" & vbLf) ’ Voltage source, Current measurement function
Call ibwrt(vig, "MD2" & vbLf) ’ Sweep source mode
Call ibwrt(vig, "SN0.05,5,0.05" & vbLf) ’ Linear Sweep: Start 0.05 V, stop 5 V, and step 0.05 V
Call ibwrt(vig, "SB0" & vbLf) ’ Sweep bias value 0 V
Call ibwrt(vig, "SP3,4,100" & vbLf) ’ Hold time 3 ms, Measurement delay time 4 ms
’ Period: 100 ms
Call ibwrt(vig, "LMI0.03" & vbLf) ’ Limiter value: 30 mA
Call ibwrt(vig, "ST1,RL" & vbLf) ’ Storing Measured Data into Data Memory (Memory Store)
ON,Clearing Saved Data (Memory Clear)
Call ibwrt(vig, "OPR" & vbLf) ’ Output ON
Call ibwrt(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
Call ibwrt(vig, "SBY" & vbLf) ’ Output OFF
’ Measurement buffer memory data recall
’ No output data header, block delimiter EOI
Call ibwrt(vig, "SZ?" & vbLf) ’ Measurement buffer memory data number query
Call ibrd(vig, dt) ’ Measurement buffer memory data number recall
dt_sz = Val(dt) ’ Converting recalled data to numerical variable
Call ibwrt(vig, "OH0" & vbLf) ’ Setting output data header to OFF