HP E8402A User And Service Manual page 46

Vxi c-size mainframe
Table of Contents

Advertisement

Example 1:
Self Test &
Verification
48 Programming the Enhanced Monitor
The following example program resets the Enhanced Monitor, performs a complete
self test (this can take up to seven minutes to complete), read the mainframe model
number string, read the mainframe serial number, and writes data to the Enhanced
Monitor display.
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
/* Interface address is 9, Enhanced Monitor secondary address is 224*/
/* #define INSTR_ADDR "GPIB0::9::224::INSTR" */
#define INSTR_ADDR "GPIB-VXI0::224::INSTR"
/* a simple VISA error-handling macro. This version prints the line number from which
it was called and exits if it gets an error */
#define CHECKERR(errStatus, line) if (errStatus < VI_SUCCESS) { \
printf("Line %d: error %x returned from visa. Aborting\n", \
line, errStatus); \
exit (errStatus); \
}
int main()
{
ViStatus errStatus;
ViSession viRM;
ViSession en_mon;
int into;
char id_string[256];
char ser_num[256]
chr txt_string[256]
char selftst_string[256];
/* Open the default resource manager */
errStatus = viOpenDefaultRM (&viRM);
CHECKERR(errStatus, __LINE__);
/* Open the Enhanced Monitor instrument session */
errStatus = viOpen(viRM,INSTR_ADDR,VI_NULL,VI_NULL,&en_mon);
CHECKERR(errStatus, __LINE__);
/* Reset the Enhanced Monitor */
errStatus = viQueryf(en_mon, "*RST;*OPC?\n","%i",&into);
CHECKERR(errStatus, __LINE__);
/* Set Timeout Value to 8 minutes for Self Test */
viSetAttribute (en_monA,VI_ATTR_TMO_VALUE,480000);
/* Perform Enhanced Monitor Self-Test - approx. 7 minutes */
errStatus = viQueryf(en_mon, "TEST:ALL?\n", "%t", selftst_string);
CHECKERR(errStatus, __LINE__);
printf("Self Test Result is %s\n", selftst_string);
PROGRAM CONTINUED NEXT PAGE
/*Status from each VISA call */
/*Resource mgr. session */
/* Enhanced Monitor session */
/* variable for *OPC? */
/* Model Number string */
/* mainframe serial number */
/* String sent to display */
/* Self-test string */
Chapter 3

Advertisement

Table of Contents
loading

This manual is also suitable for:

E8404a

Table of Contents