EasyManua.ls Logo

Agilent Technologies E3632A - Page 135

Agilent Technologies E3632A
169 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 6 Application Programs
C++ Example for GPIB(IEEE 488)
134
...continued
/* Open communication (session) with power supply */
viOpenDefaultRM (&defaultRM);
viOpen (defaultRM, Visa_address, 0,0, &power_supply);
/* Query the power supply id, read response and print */
viPrintf (power_supply, "*IDN?\n");
viScanf (power_supply, "%s", &reply_string);
printf ("Instrument identification string:\n %s\n\n", reply_string);
/* Initialize Power Supply */
viPrintf (power_supply, "*RST\n"); /* Set power on condition */
viPrintf (power_supply, "Current 2\n"); /* Set Current limit to 2A */
viPrintf (power_supply, "Output on\n"); /* Turn output on */
printf("Voltage Current\n\n"); /* Print heading */
/* Step from 0.6v to 0.8 volt in .02volt steps */
for(voltage =.6;voltage <<=.8001;voltage +=.02)
{
viPrintf (power_supply, "Volt %f\n",voltage); /*set voltage */
printf("%.3f",voltage); /* print power supply setting */
delay(500); /* allow output to settle for 500 msec */
viPrintf(power_supply,"Measure:Current?\n"); /*measure output current */
viScanf (power_supply, "%lf",&current); /* retrieve reading */
printf(" %.3lf\n",current); /* print reading */
}
viPrintf (power_supply, "Output Off\n"); /* turn off output */
/* Close communication session */
viClose (power_supply);
viClose (defaultRM);
}
/* Pauses for a specified number of milliseconds. */
void delay( clock_t wait )
{
clock_t goal;
clock_t delay;
wait = wait/1000;
delay = (clock_t)wait * CLOCKS_PER_SEC;
goal = delay + clock();
while( goal > clock() );
}
End of Program

Other manuals for Agilent Technologies E3632A

Related product manuals