Configuring the Agilent E8462A Multiplexer
33
Example: Reset,
Self Test, Module
ID, and Close
Channel
The following example reads the module ID string, performs module
self-test, displays the results, closes channel 0002 and queries the channel
closure state. The result is returned to the computer and displayed
(“1” = channel closed, “0” = channel open).
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
/* Module Logical address is 112, secondary address is 14*/
#define INSTR_ADDR “GPIB0::9::14::INSTR”
int main()
{
ViStatus errStatus;
/*Status from each VISA call*/
ViSession viRM;
/*Resource mgr. session */
ViSession E8462A;
/* Module session */
char id_string[256];
/*ID string*/
char selftst_string[256];
/*self-test string*/
char ch_state;
/*channel open/close state*/
/* Open the default resource manager */
errStatus = viOpenDefaultRM ( &viRM);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viOpenDefaultRM() returned 0x%x\n”,errStatus);
return errStatus;}
/* Open the Module instrument session */
errStatus = viOpen(viRM,INSTR_ADDR, VI_NULL,VI_NULL,&E8462A);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viOpen() returned 0x%x\n”,errStatus);
return errStatus;}
/* Reset the Module */
errStatus = viPrintf(E8462A, “*RST;*CLS\n”);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viPrintf() returned 0x%x\n”,errStatus);
return errStatus;}
/* Query the Module ID string */
errStatus = viQueryf(E8462A,”*IDN?\n”,”%t”,id_string);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viQueryf() returned 0x%x\n”,errStatus);
return errStatus;}
printf(“ID is %s\n”,id_string);
/* Close Channel 002 */
errStatus = viPrintf(E8462A, “FUNC 1,WIRE1;CLOS (@1002)\n”);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viPrintf() returned 0x%x\n”,errStatus);
return errStatus;}
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...