6241A/6242 DC Voltage Current Source/Monitor Operation Manual
6.8.2 Programming Examples with USB
6-49
Cells(1, 1) = Left(dt, 15) ’ Assigns data to the designated cell.
Call ausbwrt(vig, "SOV2") ’ DC source value 2V
Call SUBmeas(vig, dt) ’ Measurement trigger & Measurement data recall
Cells(2, 1) = Left(dt, 15) ’ Assigns data to the designated cell.
Call ausbwrt(vig, "SOV2") ’ DC source value -2V
Call SUBmeas(vig, dt) ’ Measurement trigger & Measurement data recall
Cells(3, 1) = Left(dt, 15) ’ Assigns data to the designated cell.
Call ausbwrt(vig, "SOV4") ’ DC source value 4V
Call SUBmeas(vig, dt) ’ Measurement trigger & Measurement data recall
Cells(4, 1) = Left(dt, 15) ’ Assigns data to the designated cell.
Call ausbwrt(vig, "F1") ’ Voltage-measurement function
Call ausbwrt(vig, "IF") ’ Current source function
Call ausbwrt(vig, "SOI0.002,LMV3") ’ DC source value 2 mA, limiter value 3 V
Call ausbwrt(vig, "OPR") ’ Output ON
Call SUBmeas(vig, dt) ’ Measurement trigger & Measurement data recall
Cells(5, 1) = Left(dt, 15) ’ Assigns data to the designated cell.
Call ausbwrt(vig, "SBY") ’ Output OFF
err_exit:
ret = ausb_close(vig) ’ Close device
If ret <> OK Then ’ If closing device is NG
MsgBox "Device Close Error", vbExclamation
End If
ret = ausb_end() ’ End USB
If ret <> OK Then ’ If end USB is NG
MsgBox "USB End Error", vbExclamation
End If
End Sub ’ Event procedure completed
’ Subroutine
Private Sub SUBmeas(id As Long, dt As String)
’ Measurement trigger & Measurement data recall
Call ausbwrt(id, "*TRG") ’ Measurement trigger actuated
Call ausbrd(id,dt) ’ Measurement data recall
End Sub
’ Subroutine
Private Sub ausbwrt(id As Long, command As String)
’ Send command subroutine
Dim ret As Long ’ Declares the driver return value variable.
ret = ausb_write(id, command) ’ Send command
If ret <> OK Then
MsgBox "Send Error", vbExclamation
GoTo err_exit
End If
Exit Sub
err_exit: