Agilent Technologies E1465A Automobile Parts User Manual


 
Register-Based Programming 93Appendix B
Example: Making
Measurements
(C/HP-UX)
This C/HP-UX programming example closes bit 1 on bank 0, waits for a
measurement to be made, and then opens the channel. You must insert
your own programming code for the measurement part of this program. For
example, if you are using the E1411B, see the E1326B/E1411B Multimeter
User's Manual for programming examples.
The sub ver_time allows time for switch closures. This sub should print a
time around 7 ms. If the time is less, you must change the value of j in
the for loop. For example, instead of 7000, you might need to use 10000.
/******************************************************/
/*** makemeas.c ***/
/******************************************************/
#include <time.h>
#include <sys/vxi.h> /*source file for controller VXI drivers*/
#include <fcntl.h>
#include <stdio.h>
#define logical_address 120 /*logical address of matrix module*/
int fd;
typedef unsigned short word;
typedef struct dev_regs{ /*set up pointers*/
unsigned short id_reg;
unsigned short device_type;
unsigned short status_reg;
unsigned short bank0_channels;
} DEV_REGS;
main( )
{
/*open the controller VXI interface*/
fd=open("/dev/vxi/primary",O_RDWR);
if (fd){
perror("open");
exit(1);
}
/*retrieve the A16 pointers*/
dev=(struct dev_regs *)vxi_get_a16_addr(fd,logical_address);
/*sub to verify the time to close the switch*/
ver_time( );
/*sub to close switch and make measurement*/
make_meas(dev);
} /* *END of main program*/
Continued on next page