beautypg.com

3 setting limit model, Setting limit model -16 – KEPCO KLR Series Developers Guide User Manual

Page 38

background image

3-16

KLR-DEV 060713

FIGURE 3-4. EXAMPLE OF USING A LIST, WRITTEN IN VISUAL BASIC (SHEET 2 OF 2)

3.4.3

SETTING LIMIT MODEL

The filename for this example is VBlimit model Example.txt, located in the ivi\driv-
ers\kepco\examples folder (see Figure 3-5 for complete code). This example is very similar to
the other examples in this section. The difference is that functions in the driver are used to per-
form the operation instead of setting the value to a specific state. Access to the functions is
identical to the method used to access the open and close of the driver. The functions used are:

KpDCPwr_SetAttributeViReal64 which sets the various attributes to a specific value.

KpDCPwr_EnablePasswordState which sends the string to the unit to enable the ability to set
the limit model.

Delay (100)


ReadInstrumentError driver

driver.Close

Exit Sub
errorHandler:
MsgBox Err.Description
driver.Close
Exit Sub
End Sub

Private Sub ReadInstrumentError(agDrvr As IIviDriver)
' Read instrument error queue until its empty.
Dim errCode As Long
errCode = 999
Dim errMsg As String

StatusTextBox.Text = StatusTextBox.Text & vbCrLf
While errCode <> 0
agDrvr.Utility.ErrorQuery errCode, errMsg
StatusTextBox.Text = StatusTextBox.Text & "ErrorQuery: " & errCode & ", " & errMsg & vbCrLf
Wend
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