Agilent Technologies E1476A User Manual page 112

64-channel, 3-wire multiplexer module
Table of Contents

Advertisement

Beginning of Program
/* This program resets the E1476A, reads the ID Register, reads the Device */
/* Type Register, closes tree relays and channels and reads the multiplexer's */
/* Relay Control Registers, opens channels and scans all 64 channels on the */
/* module.*/
/* (Borland Turbo C++ program using SICL I/O calls.) */
#include <sicl.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <dos.h>
/* function prototypes */
void reset_mux(char *base_addr);
void delay (unsigned milliseconds);
Program Main
void main(void)
{
double ldexp(double i, int exp);
char *base_addr;
int j, k;
unsigned short chan_0_15_reg, chan_16_31_reg;/* Bank A channels */
unsigned short chan_32_47_reg, chan_48_63_reg;/* Bank B channels */
unsigned short chan_tree_reg;/* Tree relays */
unsigned short id_reg, dt_reg;/* ID and Device Type */
unsigned short stat_reg; /* Status Register */
/* create and open a device session */
INST e1476a; e1476a = iopen("vxi,112");
/* map the E1476A registers into user memory space */
base_addr = imap(e1476a, I_MAP_VXIDEV, 0, 1, NULL);
/* clear the user screen */
clrscr();
/* reset the E1476A */
reset_mux(base_addr);
Read ID and Device Type Registers
/********* read the multiplexer's ID and Device Type registers *********/
id_reg = iwpeek((unsigned short *)(base_addr + 0x00));
dt_reg = iwpeek((unsigned short *)(base_addr + 0x02));
printf("ID register = 0x%4X\nDevice Type register = 0x%4X\n",
id_reg, dt_reg);
Read Status Register
/**************** read the multiplexer's status register **************/
stat_reg = iwpeek((unsigned short *)(base_addr + 0x04));
printf("Status register = 0x%4X\n", stat_reg);
Appendix B
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Register-Based Programming 111

Advertisement

Table of Contents
loading

Table of Contents