Agilent Technologies E1465A Manual do Utilizador Página 91

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 105
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 90
Register-Based Programming 91Appendix B
Example: Reading
the Registers
(C/HP-UX)
This C/HP-UX programming example reads the Manufacturer ID Register,
Device Type Register and Status Register on the E1466A matrix module.
/***************************************************/
/****** readreg.c ******/
/**************************************************/
#include <sys/vxi.h> /*source file for controller VXI drivers*/
#include <fcntl.h>
#include <stdio.h>
#define logical_address 120 /*logical address of the 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 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;
}
Vista de página 90
1 2 ... 86 87 88 89 90 91 92 93 94 95 96 ... 104 105

Comentários a estes Manuais

Sem comentários