beautypg.com

2 initialization of the bit 4886 card, 1 initialization using cvi driver - gpib port only, Initialization of the bit 4886 card -4 – KEPCO BIT 4886 Operator Manual User Manual

Page 38: R. 4.2

background image

4-4

BIT 4886 120413

FIGURE 4-1. PROGRAMMING EXAMPLE TO VERIFY PREVIOUS COMMAND HAS COMPLETED

4.2

INITIALIZATION OF THE BIT 4886 CARD

When a BIT 4886 Card is installed in a BOP it must be initialized prior to use. The initialization of
the BOP BIT card can be performed via either GPIB or RS 232 ports. The process can be
accomplished using the supplied computer program via the GPIB (see PAR. 4.2.1) or by send-
ing SCPI commands using either the RS 232 or GPIB protocol (see PAR. 4.2.2).

4.2.1

INITIALIZATION USING CVI DRIVER - GPIB PORT ONLY

The initialization procedure uses the “soft” front panel which is part of the CVI driver for the BIT
4886. The CVI Driver can be downloaded from the Kepco website at: www.kepcopower.com/

#include

#include

#include

#include

/*Overhead for the use of a NATIONAL INSTRUMENTS gpib interface */

int unit_desc;

// handle for the national instruments controller

int GPIbus=0;

// GPIB card 0

int adr=6;

// Power Supply address

char status_byte;

// status byte from the power supply

#define MAV 0x10 /* bit 4 of the status byte is the Message AVailable bit by 488.2 specification */

/* Function Send_with_wait

INPUT: string to be sent to power supply

Description: adds the *ESR? query and performs serial polls to wait for the command to be completed.

*/

int Send_with_wait(char *command);

char snd[501];

// data to be sent to the power supply

char rcv [10];

// data from power supply

int j;

sprintf(snd,”%s;:*ESR?,command);

// Add *ESR? to the command

// so there is a response from the

// power supply

Send(GPIbus, adr, snd, strlen(snd), 2);

// Send the data to the power supply

for (j=0;j<500;j++)(

// loop until ready (5 seconds max)

Delay(.05);

// Wait for command to complete

ibrsp(unit_desc,&status_byte);

// get status byte

if ((status_byte& 0x10) ==0x10) break;)

// by looking for data in string

Receive (GPIbus, adr, rev, rev_buf_size,10);

// so the error queue will not receive a 410 error

}

main(

// test code to show operation of function.

unit_desc=ibdev(GPIbus,adr,adr/256,T100ms,1,0x40a);Delay(.005);

Send (GPIbus,adr,”VOLT 10;curr .01”,sizeof(“VOLT 10;curr .01”),NLEND;

Send_with_wait(“*SAV 10”);

}