Setting virtual model, written in visual basic -17 – KEPCO KLP Series Developer's Guide, Rev 1 User Manual
Page 39

KLP-DEV 031113
3-17
FIGURE 3-5. SETTING VIRTUAL MODEL, WRITTEN IN VISUAL BASIC
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' This program demonstrates how to set the virtual model
' using the IVI-COM driver.
'/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Option Explicit
Public driver As KepcoDCPwr
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
' to set the password enable state we have to send a password.
' remember the password is different for all kepco models and can be changed by he user from the
front panel or other interfaces
driver.KpDCPwr_EnablePasswordState "7533"
' This will now set the virtual model to a 36-33 unit.
driver.KpDCPwr_SetAttributeViReal64 KPDCPWR_ATTR_POSITIVE_VOLTAGE_RATED_LIMIT, 36
driver.KpDCPwr_SetAttributeViReal64 KPDCPWR_ATTR_POSITIVE_CURRENT_RATED_LIMIT, 33
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