beautypg.com

KEPCO KLR Series Developers Guide User Manual

Page 32

background image

3-10

KLR-DEV 060713

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

// Initialize driver
KLRdriver.Initialize("GPIB0::6::INSTR",

true,
true,
"Cache=true,InterchangeCheck=false,QueryInstrStatus=true,Simu-

late=false");//Optional ivi options

System.Console.WriteLine("Done.\n");

// get references to the needed interfaces
outputPtr = KLRdriver.Outputs.get_Item(driver.Outputs);
listPtr = KLRdriver.List.get_Item(driver.Lists);

//create arrays for the ListPoints method
double[] voltList = new double [6];
double[] currList = new double [6];
double[] dwellTime = new double [6];

voltList[0] = 10;
voltList[1] = 20;
voltList[2] = 30;
voltList[3] = 40;
voltList[4] = 50;
voltList[5] = 60;

currList[0] = 2; // select max current for each step
currList[1] = 2;
currList[2] = 2;
currList[3] = 2;
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;

//' call ListPoints to set the list values and set the voltage and current modes to

LIST

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

// enable the output
outputPtr.Enabled = true;

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

// initiate the list in the output system
outputPtr.listInitiate();

KLRdriver.Systems.WaitForOperationComplete(10000);

//Read instrument errors
ReadInstrumentError(driver);

//' Close driver if initialized.
if (KLRdriver.Initialized == true ) KLRdriver.Close();

Console.WriteLine();
Console.Write("Press Enter to Exit ");
Console.ReadLine();

}
catch (Exception e)
{

Console.WriteLine();
Console.WriteLine("Exception Error:");
Console.WriteLine(" " + e.Message );

KLRdriver.Close();

Console.WriteLine();
Console.Write("Press Enter to Exit ");
Console.ReadLine();

}

}

}
}