
48
Programming the Enhanced Monitor
Chapter 3
Example 1:
Self Test &
Verification
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;
/*Status from each VISA call */
ViSession viRM;
/*Resource mgr. session */
ViSession en_mon;
/* Enhanced Monitor session */
int into;
/* variable for *OPC? */
char id_string[256];
/* Model Number string */
char ser_num[256]
/* mainframe serial number */
chr txt_string[256]
/* String sent to display */
char selftst_string[256];
/* Self-test string */
/* 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
Summary of Contents for E8402A
Page 8: ...10 Contents ...
Page 12: ...14 Notes ...
Page 14: ......
Page 26: ...28 Getting Started Chapter 1 ...
Page 42: ...44 Using the Enhanced Monitor Chapter 2 ...
Page 214: ...216 Servicing Your Mainframe Chapter 5 ...
Page 226: ...228 HP E8402 E8404A Product Specifications Appendix A ...