beautypg.com

KEPCO KLP Series Developer's Guide, Rev 1 User Manual

Page 36

background image

3-14

KLP-DEV 031113

FIGURE 3-3. SETTING THE OUTPUT AND TAKING A MEASUREMENT EXAMPLE, WRITTEN IN VISUAL

BASIC (SHEET 1 OF 2)

'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' This program demonstrates how to set the output voltage and current
' measure the voltage
' using the IVI-COM driver.
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Option Explicit

Public driver As KepcoDCPwr
Public outputPtr As IKLPOutput
Public protectionPtr As IKLPProtection
Public measurementPtr As IKLPMeasurement

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdStart_Click()

Set driver = New KepcoDCPwr

On Error GoTo ErrorHandler


' initialize the driver - note ID device is true
driver.Initialize "GPIB0::6::INSTR", _
True, _
True, _
"Cache=true,InterchangeCheck=false,QueryInstrStatus=true,Simu-

late=false"


Dim result As Boolean
result = driver.Initialized


Set outputPtr = driver.Outputs.Item(driver.Outputs)
Set protectionPtr = driver.Protections.Item(driver.Protections)
Set measurementPtr = driver.Measurements.Item(driver.Measurements)

' set voltage level
outputPtr.VoltageLevel 75

' enable OV protection and set OV level
protectionPtr.ConfigureOVP 15


' set current level
outputPtr.CurrentLimit 10

' enable the output
outputPtr.Enabled = True

Delay 10

' Measure the voltage
Dim measVoltage As Double
measVoltage = measurementPtr.Measure(KepcoDCPwrMeasurementVoltage)