6241A/6242 DC Voltage Current Source/Monitor Operation Manual
6.8.1 Programming Examples with GPIB
6-43
6.8.1.2 Programming Example 2: Pulse Measurement
Option Explicit ’ Explicit declaration for all variables
Private Sub Sampl2_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 Intege ’ 6241A/6242 device descriptor
Dim dt As String*20 ’ Data reception buffer
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 ibwrt(vig, "C,*RST" & vbLf) ’ DCL and parameter Initialization
Call ibwrt(vig, "OH1" & vbLf) ’ Header ON
Call ibwrt(vig, "M1" & vbLf) ’ Trigger mode hold
Call ibwrt(vig, "VF" & vbLf) ’ Voltage source function
Call ibwrt(vig, "F2" & vbLf) ’ Current measurement function
Call ibwrt(vig, "MD1" & vbLf) ’ Pulse source mode
Call ibwrt(vig, "SOV2,LMI0.003" & vbLf) ’ Pulse source value 2 V, Limiter value 3 mA
Call ibwrt(vig, "DBV1" & vbLf) ’ Pulse base value 1 V
Call ibwrt(vig, "SP3,1,130,50" & vbLf) ’ Hold time 3 ms, Measurement delay time 1 ms
’ Period 130 ms, pulse time 50 ms
Call ibwrt(vig, "OPR" & vbLf) ’ Output ON
Call SUBmeas(vig, dt) ’ Measurement trigger & data recall
Cells(1, 1) = Left(dt, 15) ’ Assigns data to the designated cell
Call ibwrt(vig, "SOV2.5" & vbLf) ’ Pulse source value 2.5 V
Call SUBmeas(vig, dt) ’ Measurement trigger & data recall
Cells(2, 1) = Left(dt, 15) ’ Assigns data to the designated cell
Call ibwrt(vig, "SP3,60,130,50" & vbLf) ’ Hold time 3 ms, Measurement delay time 60 ms
’ Period 130 ms, pulse time 50 ms
Call SUBmeas(vig, dt) ’ Measurement trigger & data recall
Cells(3, 1) = Left(dt, 15) ’ Assigns data to the designated cell
Call ibwrt(vig, "DBV0.5" & vbLf) ’ Pulse base value 0.5 V
Call SUBmeas(vig, dt) ’ Measurement trigger & data recall
Cells(4, 1) = Left(dt, 15) ’ Assigns data to the designated cell
Call ibwrt(vig, "SBY" & vbLf) ’ Output OFF
Call ibonl(vig,0) ’ Setting the 6241A/6242 to offline
End Sub ’ Event procedure completed
’ Subroutine
Private Sub SUBmeas(vig As Integer, dt As String)
’ Measurement trigger & Measurement data recall
Call ibwrt(vig, "*TRG" & vbLf) ’ Measurement trigger actuated
Call ibrd(vig,dt) ’ Measurement data recall