... continued
/**************************************************************************/
void meter_meas(void)
{
/* Configure channel 1 for dc voltage measurements on the 1 volt range
with 10 mV resolution. Configure channel 2 for dc voltage
measurements on the 1 mV range with the least resolution. */
float rdg_ch1, rdg_ch2, null_ch1, null_ch2;
static char state[2] = {13,10}; /* ASCII 13 = carriage return,
ASCII 10 = line feed */
/* Configure measurements on both channels */
IOOUTPUTS(ADDR, "CONF:VOLT:DC 1,0.01,(@FRON1);:CONFVOLT:DC 0.001,MAX,(@FRON2)", 61);
/* Channel 1: initiate measurement, transfer reading to the output buffer */
IOOUTPUTS(ADDR, "ROUT:TERM FRON1", 15);
IOOUTPUTS(ADDR, "READ?", 5);
IOENTER(ADDR, &rdg_ch1);
/* Channel 1: Turn null on */
IOOUTPUTS(ADDR, "SENS1:VOLT:DC:NULL ON", 21);
/* Place the null reading into the Null Register. To do this,
suppress the carriage return (CR) and line feed (LF) before
sending the null reading. */
/* First, disable EOI (End-or-Identify) and EOL (End-of-Line) */
IOEOI(ISC, 0);IOEOL(ISC, " ", 0);
/* Send "SENS" header and suppress CR/LF */
IOOUTPUTS(ADDR, "SENS1:VOLT:DC:NULL:VAL ", 23);
/* Re-enable EOI and EOL for normal GPIB operation and send data */
IOEOI(ISC, 1);IOEOL(ISC, state, 2);
IOOUTPUT(ADDR, rdg_ch1);
/* Channel 2: Initiate measurement, transfer reading to output buffer,
and store reading in variable */
IOOUTPUTS(ADDR, "ROUT:TERM FRON2", 15);
IOOUTPUTS(ADDR, "READ?", 5);
IOENTER(ADDR, &rdg_ch2);
Chapter 6 Application Programs
C Language Programs
236