beautypg.com

8 scpi program examples, Scpi program examples -47 – KEPCO BOP-GL 1KW Operator Manual Firmware Ver.3.05 and higher User Manual

Page 109

background image

BOP-1K-GL 022814

3-47

NOTE: If External Reference is enabled and a protection error occurs, both Voltage Protect

Error (bit 12) and Current Protect Error (bit 13) are set

• 13 - Current Protect Error — 1 indicates a Current protection error has been detected.

• 14 - Sinking — 1 indicates the unit is absorbing energy from the load.

• 15 Not Used — always zero.

3.7.8

SCPI PROGRAM EXAMPLES

Refer to Appendix B, Figures B-1 through B-13 for examples illustrating the use of SCPI com-
mands.

Figure 3-12 is an example of a program using SCPI commands to program the BOP Power
Supply. The program illustrated is for a configuration using an IBM PC or compatible with a
National Instruments GPIB interface card. (It will be necessary to consult the manufacturer’s
data to achieve comparable functions with an interface card from a different manufacturer.) This
program sets output voltage (Voltage mode) or voltage limit (Current mode) to 5V, and current
limit (Voltage mode) or output current (Current mode) to 1A, then reads the measured (actual)
voltage and current, then prints the measurements.

FIGURE 3-12. TYPICAL EXAMPLE OF BOP POWER SUPPLY PROGRAM USING SCPI COMMANDS

/**************************************************************************/
/* Sample Program For KEPCO power supply, using National Instruments */
/* GPIB interface card and IBM PC or compatible computer */
/**************************************************************************/

#include
#include "decl.h"

char rd_str[80];

// Input buffer

char dat_str[80];

// Output buffer

int bd,adr;

main() {

adr = ibfind("DEV6");

// Open DEV6 (defined by IBCONF)

bd = ibfind ("GPIB0");

// Open GPIB card

ibsic (bd);

// Send Interface Clear

ibsre(bd,1);

// Set remote line true

strcpy(dat_str,"VOLT 5;CURR 1");

// Define a set command

strcat(dat_str,"\r\n");

// Append delimiter

ibwrt(adr,dat_str,strlen(dat_str));

// Send string to power supply

strcpy(dat_str,"MEAS:VOLT?;CURR?");

// Define a measure command

strcat(dat_str,"\r\n");

// Append delimiter

ibwrt(adr,dat_str,strlen(dat_str));

// Send string to power supply

strset(rd_str,'\0');

// Clear input buffer

ibrd(adr,rd_str,64);

// Read result of measure

printf("received : %s\n",rd_str);

// Print voltage and current

}