***************** Microsoft C (Agilent 82335A/82990A/61062B GPIB Command Library) *********************

/* Assumes that you have an error handler routine, called ’error_handler’ that accepts a float. The error handler is then passed the float that is returned from each call to the library. */

#include &<stdio.h> #include k<chpib.h> #include &<cfunc.h>

#define MODULE_ADDRESS 70501L

char *cmd;

float measurement;

error = ioenter(MODULE_ADDRESS, &&measurement); error_handler(error);

**************************** Microsoft C (National Instruments GPIB Interface) ****************************

/* Assumes that you have an error handler routine, called ’error_handler’. The error handler is then passed the float that is returned from each call to the library. */

#include &<stdio.h> #include &<stdlib.h> #include &<decl.h>

#define ERR (1&<&<15)

/* Error is detected as bit 15 of ibsta */

#define STRING_LENGTH 20

/* Length of string to hold measurement */

int module_address;

/* Device is configured in the GPIB.COM handler. Use

 

ibfind( ) to assign a value to module_address. */

char measurement[STRING_LENGTH];

 

float measured_value;

/* Holds float conversion of measurement */

ibwrt(module_address, measurement, STRING_LENGTH);

 

if (ibsta & ERR)

 

error_handler();

 

measured_value = atof(measurement);

/* Converts measurement string to float */

Receiving Module Data with C

Introduction To Programming 21

Page 21
Image 21
Agilent Technologies 66lxxA manual Receiving Module Data with C