3-68 BOP HIPWR 111315FIGURE 3-21. 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 bufferchar dat_str[80]; // Output bufferint bd,adr;main() {adr = ibfind("DEV6"); // Open DEV6 (defined by IBCONF)bd = ibfind ("GPIB0"); // Open GPIB cardibsic (bd); // Send Interface Clearibsre(bd,1); // Set remote line truestrcpy(dat_str,"VOLT 5;CURR 1"); // Define a set commandstrcat(dat_str,"\r\n"); // Append delimiteribwrt(adr,dat_str,strlen(dat_str)); // Send string to power supplystrcpy(dat_str,"MEAS:VOLT?;CURR?"); // Define a measure commandstrcat(dat_str,"\r\n"); // Append delimiteribwrt(adr,dat_str,strlen(dat_str)); // Send string to power supplystrset(rd_str,'\0'); // Clear input bufferibrd(adr,rd_str,64); // Read result of measureprintf("received : %s\n",rd_str); // Print voltage and current}