User manual

Chapter 6 Application Programs
Example Program for C and C++
123
6
Example Program for C and C++
User’s Guide
®
®
®
c:\vxipnp\win(win95 winnt)\lib\msc
c:\vxipnp\win (win95 winnt)\include
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; /* Resource manager id */
ViSession power_supply; /* Identifies power supply */
int bGPIB = 1; /* Set the number to 0 for use with the RS-232 */
long ErrorStatus; /* VISA Error code */
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; /* Value of voltage sent to power supply */
char Buffer[256]; /* String returned from power supply */
double current; /* Value of current output of power supply */
Continued on next page