beautypg.com

KEPCO KLP Series Developers Guide, Rev 3 User Manual

Page 68

background image

5-6

KLP-DEV 041213

FIGURE 5-2. EXAMPLE 2: USING THE POWER SUPPLY TO CREATE A VOLTAGE RAMP (SHEET 2 OF 2)

Kpklp_Set_Volt_Curr (KLP_Session, voltage, current); //voltage and current

/*

The above function sets both the voltage and current setpoint of the power supply

*/

Kpklp_OutputOnOff ( KLP_Session, 1); // output on

for (i=0;i<10;i++){

// generates the ramp ten times

for (voltage-voltage_start; voltage <=voltage_end; voltage+=voltage_change){

KpKlp_SetValue (KLP_Session, voltage,0); // set the voltage level only

Delay(500); // delay for 500 milliseconds

}

KpKlp_SetValue (KLP_Session, voltage_start,0); // set the voltage level only

delay (1000); // wait for unit to return to zero (no load)

} // end of all ramps

Kpklp_OutputOnOff ( KLP_Session, 0); // output off

Kpklp_close( KLP_Session); // free up memory and close VISA session

return (power_supply_status);

} // end of main

// if not created as a project, include the driver code at end of program

#include "Kp_klp.c"