Agilent Technologies E3632A Computer Accessories User Manual


 
Chapter 6 Application Programs
C++ Example for GPIB(IEEE 488)
133
6
C++ Example for GPIB(IEEE 488)
visa.lib visa.h
c:\vxipnp\win\lib\msc\ c:\vxipnp\win\include
Diode.c
/*Diode.C
This example program steps the E3632A DC Power Supply through 10 voltages and measures the
current response. It prints the voltage step and the current response as a table. Note that
the GPIB address is the default address from the factory for the E3632A.*/
#include <visa.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
/* Provides a delay of the specified time wait in milliseconds*/
void delay( clock_t wait );
void main ()
{
ViSession defaultRM; /* resource manager id */
ViSession power_supply; /* session id to an instrument */
char reply_string [256]; /* string returned from instrument */
char GPIB_address [3]; /* GPIB address of instrument */
char Visa_address[40]; /* Complete VISA address send to card */
double voltage; /* value of voltage sent to power supply */
double current; /* value of current output of power supply */
/* build the address needed to open communication with GPIB card */
/* address format looks like this; GPIB0::5::INSTR */
/* */
strcpy(GPIB_address, "5"); /****** Change GPIB address here *****/
strcpy(Visa_address, "GPIB0::");
strcat(Visa_address, GPIB_address);