2 using a list to perform a series of operations, Using a list to perform a series of operations -15 – KEPCO KLR Series Developers Guide User Manual
Page 37

KLR-DEV 060713
3-15
FIGURE 3-3. SETTING THE OUTPUT AND TAKING A MEASUREMENT EXAMPLE,
WRITTEN IN VISUAL BASIC (SHEET 2 OF 2)
3.4.2
USING A LIST TO PERFORM A SERIES OF OPERATIONS
The filename for this example is VBListexample.txt, located in the ivi\drivers\kepco\examples
folder (see Figure 3-6 for complete code).
FIGURE 3-4. EXAMPLE OF USING A LIST, WRITTEN IN VISUAL BASIC (SHEET 1 OF 2)
' display the measured voltage
StatusTextBox.Text = StatusTextBox.Text & "Measured Voltage is " & measVoltage & " at chan-
nel " & channel
StatusTextBox.Refresh
ReadInstrumentError driver
driver.Close
StatusTextBox.Text = StatusTextBox.Text & "Driver closed." & vbCrLf
StatusTextBox.Refresh
Exit Sub
ErrorHandler:
MsgBox Err.Description
driver.Close
Exit Sub
End Sub
' Wait the specified number of seconds
Private Sub Delay(DelayTime As Single)
Dim Finish As Single
Finish = Timer() + DelayTime
Do
Loop Until Finish <= Timer()
End Sub
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'This program executes a 6 point current and voltage list.
' It also specifies 3 different dwell times.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Option Explicit
Public driver As KepcoDCPwr
Public outputPtr As IKepcoKLROutput
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdStart_Click()
Set driver = New KepcoDCPwr
On Error GoTo errorHandler
' initialize the driver
driver.Initialize "GPIB0::6::INSTR", _
False, _
True, _
"Cache=true,InterchangeCheck=false,QueryInstrStatus=true,Simulate=false"
Dim result As Boolean
result = driver.Initialized
' get references to the needed interfaces
Set outputPtr = driver.Outputs.Item(driver.Outputs)
Set listPtr =driver.list