beautypg.com

KEPCO BOP 1KW-MG Operator Manual, Firmware Ver.3.05 to 4.07 User Manual

Page 129

background image

BOP HIPWR 031912

3-65

A zero to one transition of a condition register is added to the event register. Reading an event
register clears all of the bits found in the event register. If any bits are set in an event register,
the following condition register bit is then set. For example, if the STAT:QUES:ENB (enable)
register has bit 0 set and a voltage error is detected, the event registers bit 0 is set. The 1 in the
event register causes bit 3 of the status byte to be asserted. The Service Request register is
ANDed with its enable register for all bits except bit 6. The result is placed in bit 6 of the Service
Request register. If bit 6 is a 1 (true), it causes the power supply to assert the SRQ line to the
host controller.

Figure 3-20 also shows that if the error/event queue is not empty, bit 3 is set in the Service
Request register and bit 4 indicates that a message is available in the output buffer.

FIGURE 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 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

}