Agilent Technologies E1339A User's And Scpi Programming Manual page 31

72-channel open collector digital output/relay driver module
Table of Contents

Advertisement

30 Configuring the Relay Driver Module
/* Example: Reset, Self-Test, and Module ID */
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
#define INSTR_ADDR "GPIB-VXI::120::INSTR" /* 120 is the E1339A*/
long main()
{
ViStatus errStatus;
ViSession viRM;
ViSession E1339;
char id_string [256] = {0};
char selftst_string[256] = {0};
/* Open a default Resource Manager */
errStatus = viOpenDefaultRM (&viRM);
if (VI_SUCCESS > errStatus){
printf("ERROR: viDefaultRM() returned 0x%x\n",errStatus);
return errStatus;}
/* Open the Instrument Session */
errStatus = viOpen (viRM, INSTR_ADDR,VI_NULL,VI_NULL, &E1339);
if (VI_SUCCESS > errStatus){
printf("ERROR: viOpen() returned 0x%x\n",errStatus);
return errStatus;}
/* Reset the E1339A */
errStatus = viPrintf (E1339, "*RST;*CLS\n");
if (VI_SUCCESS > errStatus){
printf("ERROR: viPrintf() returned 0x%x\n",errStatus);
return errStatus;}
/* Send the Self Test Command */
errStatus = viQueryf (E1339, "*TST?\n","%t",selftst_string);
if (VI_SUCCESS > errStatus){
printf("ERROR: viQueryf() returned 0x%x\n",errStatus);
return errStatus;}
printf("Self Test Result is %s\n",selftst_string);
/* Query the ID string */
errStatus = viQueryf (E1339, "*IDN?\n","%t",id_string);
if (VI_SUCCESS > errStatus){
printf("ERROR: viQueryf() returned 0x%x\n",errStatus);
return errStatus;}
printf("IDN? returned %s\n",id_string);
/* Close Sessions */
errStatus = viClose (E1339);
if (VI_SUCCESS > errStatus){
printf("ERROR: viClose() returned 0x%x\n",errStatus);
return 0;}
errStatus = viClose (viRM);
if (VI_SUCCESS > errStatus){
printf("ERROR: viClose() returned 0x%x\n",errStatus);
return 0;}
}
/* logical address */
/* status from VISA call */
/* Resource Mgr. session */
/* session for E1339A */
/* ID string buffer */
/* End of main program */

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z2309a

Table of Contents