E X A M P L E P R O G R A M F O R C A N D - Agilent Technologies E3633A Operating Manual

Hide thumbs Also See for E3633A:
Table of Contents

Advertisement

Chapter 6 Application Programs
Example Program for C and C++
Example Program for C and C++
T h e 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 y o u h o w t o s e n d a n d r e c e i v e
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 m i n g s h o w s y o u h o w t o u s e t h e S C P I
c o m m a n d s f o r t h e i n s t r u m e n t w i t h t h e V I S A f u n c t i o n a l i t y a n d d o e s i n c l u d e
e r r o r t r a p p i n g . F o r m o r e i n f o r m a t i o n o n n o n - f o r m a t t e d I / O a n d e r r o r t r a p p i n g ,
r e f e r t o t h e A g i l e n t V I S A
T h e 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 w a s w r i t t e n i n M i c r o s o f t
v e r s i o n 1 . 5 2 u s i n g 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 ' ' , a n d u s i n g t h e l a r g e
m e m o r y m o d e l a n d C + + v e r s i o n 4 . x o r 5 . 0 u s i n g p r o j e c t t y p e " W i n d o w s 3 2
a p p l i c a t i o n ' ' . B e s u r e t o m o v e t h e " v i s a . l i b ( W i n d o w s
( W i n d o w s
d i r e c t o r y . T h e s e a r e u s u a l l y f o u n d i n t h e
c:\vxipnp\win (win95
o r
Diode.c
/*Diode.C
This example program steps the power supply through 11 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 power supply.*/
#include <visa.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <conio.h>
#include <stdlib.h>
ViSession
defaultRM;
ViSession
power_supply;
int
bGPIB = 1;
long
ErrorStatus;
char
commandString[256];
char
ReadBuffer[256];
void
delay(clock_t wait);
void
SendSCPI(char* pString);
void
CheckError(char* pMessage);
void
OpenPort();
void main()
{
double
voltage;
char
Buffer[256];
double
current;
User's Guide
®
9 5 / N T ) " a n d " v i s a . h " 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
winnt)\include
o r
/* Resource manager id
/* Identifies power supply
/* Set the number to 0 for use with the RS-232 */
/* VISA Error code
/* Value of voltage sent to power supply
/* String returned from power supply
/* Value of current output of power supply
.
®
3 . 1 ) o r v i s a 3 2 . l i b
c:\vxipnp\win(win95
o r
d i r e c t o r y .
Continued on next page
®
V i s u a l C + +
winnt)\lib\msc
*/
*/
*/
6
*/
*/
*/
123

Advertisement

Table of Contents
loading

This manual is also suitable for:

E3634a

Table of Contents