C / GPIB (Program 1)
/***************************************************************************
This program sets up a burst waveform with a 270 degree starting phase.
By adding an offset voltage to the burst, a "haversine" is created.
This program also shows the use of a trigger received over the GPIB
interface to initiate a single burst.
***************************************************************************/
#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 710L /* Set GPIB address for function generator */
/* Function Prototypes */
void rst_clear(void);
void out_waveform(void);
void command_exe(char *commands[], int length);
void burst_trig(void);
void check_error(char *func_name);
/**************************************************************************/
void main(void) /* Start of main() */
{
rst_clear(); /* Reset the instrument and clear error queue */
out_waveform(); /* Set up burst modulation parameters */
burst_trig(); /* Trigger the function generator */
}
/**************************************************************************/
void rst_clear(void)
{
/* Reset the function generator, 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. */
float value;
IOOUTPUTS(ADDR, "*RST;*CLS;*OPC?", 15);
IOENTER(ADDR, &value);
}
/**************************************************************************/
6
Chapter 6 Application Programs
Using the APPLy Command
249