
50
Programming the Enhanced Monitor
Chapter 3
Example 2:
Setting up the
Mainframe
The following example program demonstrates how to customize the mainframe’s
Enhanced Monitor features. Specifically, it enables the status subsystem, sets
temperature limits for a specific slot in the mainframe and verifies the limit. To
simulate a limit warning, you can set the limit to a value lower than ambient
temperature.
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
/* Interface address is 9, Enhanced Monitor default secondary address is 224 */
/* #define INSTR_ADDR “GPIB0::9::224::INSTR” */
#define INSTR_ADDR “GPIB-VXI0::224::INSTR”
/* Enable STAT:OPER bits for Calibrating, Measuring, History Queue Full */
#define OPER_ENAB (ViUInt16)0x0411
/* Enable STAT:QUES bits for Voltage Summary, Current Summary, Power,
Temperature summary, Calibration, Blower summary, UMCounter, Unexpected
parameter */
#define QUES_ENAB (ViUInt16)0x471B
/* Set absolute temperature limit TEMP_LIM (45
°
C) for slot LIM_SLOT (slot 6)*/
#define LIM_SLOT “OUT6”
#define TEMP_LIM (ViInt16)45
/* 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 */
ViUInt16 echoed_limit;
/* For verification of programmed temp
limit */
/* 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__);
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 ...