C / HP-IB Example 2
This program example demonstrates two input channels can be
independently configured and used.
/***************************************************************************
This program configures the meter for voltage measurements on two
input channels. The channels are set to different ranges and resolutions
to show the independence of the settings for each channel.
***************************************************************************/
#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 ISC 7L /* Assign GPIB select code */
#define ADDR 722L /* Set GPIB address for meter */
/* Function Prototypes */
void rst_clear(void);
void meter_meas(void);
void command_exe(char *commands[], int length);
void check_error(char *func_name);
/**************************************************************************/
void main(void) /* Start of main() */
{
rst_clear(); /* Reset the instrument and clear error queue */
meter_meas(); /* Set up meter for measurement */
}
/**************************************************************************/
void rst_clear(void)
{
/* Reset the meter, 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
C Language Programs
235