beautypg.com

Figure 3-2. example of using a list, written in c, Example of using a list, written in c# -9 – KEPCO KLP Series Developer's Guide, Rev 1 User Manual

Page 31

background image

KLP-DEV 031113

3-9

currList[4] = 2;
currList[5] = 2;

dwellTime[0] = 1;
dwellTime[1] = 2;
dwellTime[2] = 3;
dwellTime[3] = 4;
dwellTime[4] = 5;
dwellTime[5] = 0.01;

The following command uses the IVI-COM driver to send the lists to the KLP. Note that the
arrays are passed by reference to the driver.

listPtr.ListPoints(ref voltList, ref currList, ref dwellTime);

The list is set to perform the required number of executions, then started:

// Set the number of executions.
listPtr.count = 2;

// initiate
outputPtr.listInitiate();

The driver should be closed at the end using the following code. The conditional statement
allows the close to be added to the end of the program without getting any runtime errors.

//' Close driver if initialized.

if (KLPdriver.Initialized == true ) KLPdriver.Close();

FIGURE 3-2. EXAMPLE OF USING A LIST, WRITTEN IN C# (SHEET 1 OF 2)

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'This program executes a 6 point current and voltage list.
' It also specifies 6 different dwell times.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

using System;
using KepcoDCPwr.Interop;

namespace ListExample
{
///


/// Summary description for Class1.
///

class Class1
{

///


/// The main entry point for the application.
///

[STAThread]
static void Main(string[] args)
{

// Create driver instance.
KepcoDCPwr KLPdriver;
KepcoDCPwr.Interop.IOutput outputPtr;
KepcoDCPwr.Interop.IList listPtr;
KLPdriver = new KepcoDCPwrClass();

try
{