HP E8402A User And Service Manual page 52

Vxi c-size mainframe
Table of Contents

Advertisement

Example 4:
Reading
Current Status
Information
54 Programming the Enhanced Monitor
The following example program reads the current status of the VXI mainframe and
reads trace data or histogram data from slot 5 of the VXI mainframe.
#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. Abort!\n", line, errStatus); \
exit (errStatus); \
}
int main()
{
ViStatus errStatus;
ViSession viRM;
ViSession en_mon;
short tracArray[400];
char preamble[1024];
int siz, i, scaledTimes[360];
float scaledTemps[360];
ViInt16 format, type, points, count;
float yincrement;
ViInt16 xincrement, xreference, yorigin, yreference; /* utility variables for
ViInt32 xorigin;
int histArray[10];
int minArray[10], maxArray[10]; /* HISTogram "bucket" boundaries */
/* 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__);
errStatus = viSetAttribute(en_mon, VI_ATTR_TMO_VALUE, 10000);
/* Reset the Enhanced Monitor */
errStatus = viPrintf(en_mon, "*RST\n");
CHECKERR(errStatus, __LINE__);
/* Status from each VISA call */
/* Resource mgr. session */
/* Enhanced Monitor session */
/* Stores up to 360 points from a TRAC */
/* Receives PREamble textual info */
/* utility variables for PREamble */
/* utility variables for PREamble */
PREamble */
/* utility variable for PREamble */
/* HIST:TEMP:HIST data storage for OUT5 */
Chapter 3

Advertisement

Table of Contents
loading

This manual is also suitable for:

E8404a

Table of Contents