KEPCO KLR Series Developers Guide User Manual
Page 28

3-6
KLR-DEV 060713
The setting of voltage and current is then very simple.
// set voltage
hr = outputPtr->VoltageLevel(75.0);
if (FAILED(hr))
exit(1);
// set the current limit
hr = outputPtr->CurrentLimit(10);
if (FAILED(hr))
exit(1);
// enable the output
outputPtr->Enabled = true;
Sleep(500);
Note that a measurement requires accessing a function, not a variable.
// measure the voltage
double measVoltage;
measVoltage = measurementPtr->Measure(KepcoDCPwrMeasurementVoltage);
FIGURE 3-1. EXAMPLE OF SETTING THE OUTPUT AND TAKING A MEASUREMENT,
WRITTEN IN C++ (SHEET 1 OF 2)
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 This program demonstrates how to set a voltage and current 
 measure the output voltage
 using the IVI-COM driver. 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include 
#include 
#include 
#include 
#import "IviDriverTypeLib.dll" no_namespace
#import "IviDCPwrTypeLib.dll" no_namespace
#import "KepcDCPwr.dll" no_namespace
int main(int argc, char* argv[])
{
HRESULT hr;
try 
{
hr = CoInitialize(NULL);
if (FAILED(hr))
exit(1);
// create a safe pointer for interface access
IKLRPtr driverPtr=NULL;
hr = driverPtr.CreateInstance(__uuidof(KepcoDCPwr));
if (FAILED(hr))
exit(1);
