beautypg.com

2 program practices, Examples – KEPCO BOP VISA Driver (Universal, GPIB) User Manual

Page 15

background image

BOP-VISA 010906

15/(16 Blank)

2.2 PROGRAM PRACTICES

In addition to providing prototype functions listed in Table 3, the BOP_MDAC.H file, also provides enumer-
ations for various Kepco-specific variables. The PS_TYPE enumeration defines the various Kepco BOP
models supported by the driver and the associated INVALID TYPE. The CAL:MODE and CAL:STATe enu-
merations provide details for the calibration of various BOP/BIT combinations.

3. EXAMPLES

The following examples show the functions needed to set voltage to 15V, current to 2 amp and output ON.

Example 1:

#INCLUDE “BOP_MDAC.N”

/*add definition for driver prototype*/

ViByte ps_type;
ViSession BOP_Session;

Kpbop_init ("GPIB0::6", 1, &ps_type, &BOP_Session); //init ps
Kpbop_Set_Volt_Curr (BOP_Session, 15, 2);

//voltage and current

Kpbop_OutputOnOff ( BOP_Session, KEPCO_ON);

//output on

Example 2:

#INCLUDE “BOP_MDAC.N”

/*add definition for driver prototype*/

ViByte ps_type;
ViSession BOP_Session;

Kpbop_init ("GPIB0::6", 1, &ps_type, &BOP_Session); //init ps
Kpbop_SetValue (BOP_Session, KEPCO_VOLT, 15);

//voltage

Kpbop_SetValue (BOP_Session, KEPCO_CURRENT, 2);//current
Kpbop_OutputOnOff ( BOP_Session, KEPCO_ON);

//output on

Delay (1);
Kpbop-SetValue BOP_SESSION, KEPCO_VOLT, 25);

//voltage now 25 volts

Delay (1);
Kpbop-SetValue BOP_SESSION, KEPCO_VOLT, 10);

//voltage now 10 volts