beautypg.com

Figure 5-1. example 1: setting voltage and current – KEPCO KLP Series Developer's Guide, Rev 1 User Manual

Page 66

background image

5-4

KLP-DEV 031113

sible id_str variable statements have been provided, depending on the interface being used.
The id_str statements for the interfaces not used must be commented out, otherwise errors will
result.

FIGURE 5-1. EXAMPLE 1: SETTING VOLTAGE AND CURRENT (SHEET 1 OF 2)

#include

#include

#include "kp_klp.h"

/* Order of the H files is important.

visa.h uses some of the formation functions

kp:klp.h needs definitions from vias.h to compile correctly

***** end of required h files */

Void main{

/* call function to set power supply to 15 volts at 12 amperes */

Set_powersupply(15,12);

}

/* function Set_powersupply

Sets power supply to the supplied voltage and current.

Also sets the output on as setting to a voltage and current

implies output being placed on */

ViStatus Set_powersupply (ViReal64 voltage, ViReal64 current){

ViByte ps_type;

ViSession KLP_Session;

ViStatus power_supply_status = VI_SUCCESS;

/* select one of the following ViChar id_str{}strings depending upon port to be used and

comment out the rest */

ViChar id_str{}="GPIB::06::INSTR"; // change 06 to the GPIB address of unit.

/* For LAN ports ( - change 192.168.0.100 to IP address found via front panel interface

*/

ViChar id_str()="TCIP::192.168.0.100::INSTR"; // VXI-11 instrument- via LAN port 1024

ViChar id_str()="TCIP::i92.168.0.100::5025::SOCKET"; // SCPI-RAW port (5025) LAN instrument

/* For RS 232 change 0 to actual communications port in use */

ViChar id_str()="ASRL0::INSTR"; // serial port