Chapter 6 Application Programs
Using the APPLy Command
130
C / GPIB (Program 1)
/***************************************************************************
This program sets up output voltages and currents for three outputs.
This program also shows how to use "state storage" to store the instrument
configuration in memory.
***************************************************************************/
#include <stdio.h> /* Used for printf() */
#include <stdlib.h> /* Used for atoi() */
#include <string.h> /* Used for strlen() */
#include <cfunc.h> /* Header file from GPIB Command Library */
#define ADDR 705L /* Set GPIB address for power supply */
/* Function Prototypes */
void rst_clear(void);
void out_setting(void);
void output_on(void);
void command_exe(char *commands[], int length);
void state_save(void);
void check_error(char *func_name);
/**************************************************************************/
void main(void) /* Start of main() */
{
rst_clear(); /* Reset the instrument and clear error queue */
output_on(); /* Enable the outputs
out_setting(); /* Set output voltages currents */
state_save(); /* Save a state of the power supply */
}
/**************************************************************************/
void rst_clear(void)
{
/* Reset the power supply, clear the error queue, and wait for
commands to complete. A "1" is sent to the output buffer from the
*OPC? command when *RST and *CLS are completed. */
IOOUTPUTS(ADDR, "*RST;*CLS;*OPC", 14);
}
/**************************************************************************/