Example: Reading The Registers (C/Hp-Ux) - Agilent Technologies E1463A User's Manual And Scpi Programming Manual

32-channel, 5 amp, form c switch scpi programming guide
Hide thumbs Also See for E1463A:
Table of Contents

Advertisement

Example: Reading
the Registers
(C/HP-UX)
86 Register-Based Programming
This C/HP-UX programming example reads the Manufacturer ID Register,
Device Type Register and Status Register on the Form C switch.
/***************************************************/
/******
/**************************************************/
#include
<sys/vxi.h>
#include
<fcntl.h>
#include
<stdio.h>
#define logical_address 120 /*logical address of the Form C module*/
int fd;
typedef unsigned short word;
typedef struct dev_regs{
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 read the registers*/
read_reg(dev);
/*END of main program*/
}
/*SUB READ_REG*/
int read_reg(reg_ptr)
DEV_REGS *reg_ptr;
{
/*read the ID register*/
printf("\n ID Register = 0x%x\n",reg_ptr->id_reg);
/*read the Device Type register*/
printf("\n Device Type Register = 0x%x\n",reg_ptr->device_type);
/*read the Status register*/
printf("\n Status Register = 0x%x\n",reg_ptr->status_reg);
return;
}
readreg.c
/*source file for controller VXI drivers*/
/*set up pointers*/
******/
Appendix B

Advertisement

Table of Contents
loading

Table of Contents