142
Register-Based Programming
Beginning of Program
/* This program reads the ID Register, reads the Device Type Register, */
/* reads the Status Register, reads the modules bank 0 Register, */
/* and closes channels 000 and 001. */
/* (Visual C/C++ program using Agilent VISA I/O calls.) */
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
/* Function prototype */
void err_handler();
Program Main
void main(void)
{
viSession defaultRM,mux;
unsigned short id_reg, dt_reg; /* ID and Device Type Registers */
unsigned short stat_reg, bank0_ch; /* status reg and bank 0 reg */
/* create and open a device session */
ViStatus err;
ViOpenDefaultRM(&defaultRM);
/*** GPIB card address 9, MUX logical address 112 ***/
viOpen(defaultRM,”GPIB0::9::14::INSTR”,VI_NULL,VI_NULL,&mux);
Read ID and Device Type Registers
/********* read the multiplexer's ID and Device Type registers *********/
err=viIn16(mux,VI_A16_SPACE, 0x00,&id_reg);
if(err<VI_SUCCESS) err_handler(mux,err);
printf(“ID Register=0x%4X\n”,id_reg);
err=viIn16(mux,VI_A16_SPACE, 0x02,&id_reg);
if(err<VI_SUCCESS) err_handler(mux,err);
printf(“Device Type Register=0x%4X\n”,dt_reg);
Read Status Register
/**************** read the multiplexer's status register **************/
err=viIn16(mux,VI_A16_SPACE, 0x04,&stat_reg);
if(err<VI_SUCCESS) err_handler(mux,err);
printf(“Status Register=0x%4X\n”,stat_reg);
Read Bank 0 Control Register
/******************** read bank 0 ch 000-015 register *******************/
err=viIn16(mux,VI_A16_SPACE, 0x20,&bank0_ch);
if(err<VI_SUCCESS) err_handler(mux,err);
printf(“Bank 0 ch 000-015 Register value =0x%4X\n”,bank0_ch);
Scan channels
/********************** clos channels 000 & 001 **********************/
err=viIn16(mux,VI_A16_SPACE, 0x20,&bank0_ch);
if(err<VI_SUCCESS) err_handler(mux,err);
Summary of Contents for E8462A
Page 2: ...x...
Page 10: ...8 Notes...
Page 11: ...9 Notes...
Page 12: ...10 Notes...
Page 15: ...Configuring the Agilent E8462A Multiplexer 13 Figure 1 1 Agilent E8462A Simplified Schematic...
Page 68: ...66 Using the Multiplexer...
Page 104: ...102 Agilent E8462A Relay Multiplexer Command Reference...
Page 118: ...116 Agilent E8462A Relay Multiplexer Command Reference...
Page 126: ...124 Agilent E8462A Scanning Voltmeter Application Examples Chapter 4 Notes...
Page 146: ...144 Register Based Programming...
Page 156: ...154 Index...