3-18
BHK-1/2-MG 030916
Failure to provide an adequate delay can result in:
• Commands that are not processed,
• The following command may be received in error, causing an error in the transmission,
• Unit lock-up requiring power cycling of the unit. If working via the GPIB bus, sending
Interface Clear and Device Clear followed by *RST will unlock the unit.
FIGURE 3-2. PROGRAMMING EXAMPLE TO VERIFY PREVIOUS COMMAND HAS COMPLETED
3.4
BHK-MG VISA INSTRUMENT DRIVER
The VISA instrument driver simplifies programming with a VISA compatible GPIB controller. and
Includes 1) source code (C) for all VISA functions, and 2) a complete programming reference
#include <formatio.h>
#include <utility.h>
#include <gpib.h>
#include <ansi_c.h>
/*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 *OPC? 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;:*OPC?,command);
// Add *OPC? 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”);
}
Summary of Contents for BHK-MG Series
Page 2: ......
Page 6: ......
Page 16: ......
Page 18: ...xii BHK MG030916 FIGURE 1 1 BHK MG 40W SERIES PROGRAMMABLE POWER SUPPLY...
Page 26: ...1 8 BHK 1 2 MG OPR 030916 FIGURE 1 3 RA 24 RACK ADAPTER WITH TWO 1 2 RACK BHK MG 40W UNITS...
Page 35: ...BHK 1 2 MG SERIES 030916 2 3 FIGURE 2 2 BHK MG SERIES REAR PANEL CONTROLS AND CONNECTIONS...
Page 100: ...3 54 BHK 1 2 MG 030916 FIGURE 3 20 SERIES AUTOMATIC CONFIGURATION...
Page 113: ...BHK 1 2 MG 030916 3 67 FIGURE 3 25 PARALLEL MASTER SLAVE CURRENT MODE CONFIGURATION...
Page 150: ......