Download Print this page

Agilent Technologies E3632A User Manual page 136

Dc power supply
Hide thumbs Also See for E3632A:

Advertisement

Chapter 6 Application Programs
C++ Example for GPIB(IEEE 488)
C++ Example for GPIB(IEEE 488)
T h i s f o l l o w i n g C p r o g r a m m i n g e x a m p l e s h o w s s e n d i n g a n d r e c e i v i n g
f o r m a t t e d I / O . A l s o s e e y o u r V I S A u s e r ' s g u i d e f o r n o n - f o r m a t t e d I / O . T h i s
e x a m p l e p r o g r a m i s i n t e n d e d t o s h o w t h e u s e o f S C P I c o m m a n d s a n d V I S A
f u n c t i o n a l i t y a n d d o e s n o t i n c l u d e e r r o r t r a p p i n g . E r r o r t r a p p i n g , h o w e v e r , i s
g o o d p r o g r a m m i n g p r a c t i c e a n d i s r e c o m m e n d e d i n y o u r a p p l i c a t i o n . S e e y o u r
V I S A u s e r ' s g u i d e f o r m o r e i n f o r m a t i o n a b o u t e r r o r t r a p p i n g .
T h e e x a m p l e p r o g r a m w a s w r i t t e n i n M i c r o s o f t V i s u a l C + + v e r 1 . 5 2 , p r o j e c t
t y p e " Q u i c k W i n a p p l i c a t i o n ' ' , u s i n g t h e l a r g e m e m o r y m o d e l .
t h e "
T h e s e a r e u s u a l l y f o u n d a t
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;
ViSession power_supply;
char reply_string [256]; /* string returned from instrument
char GPIB_address [3];
char Visa_address[40];
double voltage;
double current;
/* build the address needed to open communication with GPIB card */
/* address format looks like this; GPIB0::5::INSTR */
/*
strcpy(GPIB_address, "5"); /******
strcpy(Visa_address, "GPIB0::");
strcat(Visa_address, GPIB_address);
v isa.lib
v isa.h
a n d "
" f i l e t o t h e l i b a n d i n c l u d e d e v e l o p m e n t d i r e c t o r y .
c:\vxipnp\win\lib\msc\
/* resource manager id
/* session id to an instrument
/* GPIB address of instrument
/* Complete VISA address send to card
/* value of voltage sent to power supply
/* value of current output of power supply */
Change GPIB address here *****/
B e s u r e t o m o v e
c:\vxipnp\win\include
a n d
.
*/
*/
*/
*/
*/
*/
*/
133
6

Advertisement

loading