Example: Reset, Self Test, Module Id, And Close Channel - Agilent Technologies E8462A User Manual

256-channel relay multiplexer
Table of Contents

Advertisement

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;
ViSession viRM;
ViSession E8462A;
char id_string[256];
char selftst_string[256];
char ch_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;}
Configuring the Agilent E8462A Multiplexer
/*Status from each VISA call*/
/*Resource mgr. session */
/* Module session */
/*ID string*/
/*self-test string*/
/*channel open/close state*/
33

Advertisement

Table of Contents
loading

Table of Contents