Continued On Next Page - HP E3633A User Manual

Table of Contents

Advertisement

Chapter 6 Application Programs
Example Program for C and C++
OpenPort();
/* Query the power supply id, read response and print it */
sprintf(Buffer,"*IDN?");
SendSCPI(Buffer);
printf("Instrument identification string:\n
SendSCPI("*RST");
SendSCPI("Current 2");
SendSCPI("Output on");
printf("Voltage
/*Step from 0.6 to 0.8 volt in 0.02 steps */
for(voltage = 0.6; voltage <=0.8001; voltage +=0.02)
{
printf("%.3f",voltage);
/* Set output voltage */
ErrorStatus = viPrintf(power_supply,"Volt %f\n",voltage);
if(!bHPIB)
delay(500);/* 500 msec wating for RS-232 port*/
CheckError("Unable to set voltage");
/* Measure output current */
ErrorStatus = viPrintf(power_supply,"Measure:Current?\n");
CheckError("Unable to write device");
delay(500);
/* Retrieve reading */
ErrorStatus = viScanf(power_supply,"%lf",&current);
CheckError("Unable to read voltage");
printf("%6.4f\n",current);
}
SendSCPI("Output off");
ClosePort();
}
/* Build the address required to open commnuication with HP-IB card or RS-232.*/
/* The address format looks like this: "GPIB0::5::INSTR".
/* To use the RS-232 interface using COM1 port, change it to "ASRL1::INSTR"
/* address format */
void OpenPort()
{
char
HPIB_Address[3];
char
COM_Address[2];
char
VISA_address[40];
if(bHPIB)
strcpy(HPIB_Address,"5");
else
strcpy(COM_Address,"1");
136
/* Set power-on condition
/* Set current limit to 2A
/* Turn output on
Current\n\n");
/* Display diode voltage*/
/* Allow output to wait for 500 msec */
/* Display diode current */
/* Turn output off
/* Complete VISA address sent to card
/* Select HP-IB address between 0 to 30*/
/* Set the number to 2 for COM2 port */
%s\n\n",Buffer);
*/
*/
*/
/* Print heading
*/
*/
*/

Continued on next page

*/
*/

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

E3634a

Table of Contents