Agilent Technologies E1465A Automobile Parts User Manual


 
96 Register-Based Programming Appendix B
Example: Scanning
Channels (C/HP-UX)
This C/HP-UX programming example scans through the bank 0 channels
(closing one switch at a time) and makes measurements between switch
closures. 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.
NOTE The sub ver_time allows time for the switches to close. The program 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.
The math.h include file requires a -lm option when compiling this program.
/******************************************************/
/*** scanning.c ***/
/******************************************************/
#include <time.h>
#include <math.h> /*file to perform math functions*/
#include <sys/vxi.h> /*source file for controller VXI drivers*/
#include <fcntl.h>
#include <stdio.h>
#define logical_address 120 /*logical address of Form C Switch*/
#define lastch 15
int fd, i, j, reg;
double y;
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 dummy[13];
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);
Continued on next page