HP E8402A User And Service Manual page 50

Vxi c-size mainframe
Table of Contents

Advertisement

Example 3:
Set-up the
RS-232
Note
52 Programming the Enhanced Monitor
The following example program demonstrates how to set-up the RS-232 Port on the
Enhanced Monitor. In this setup, the Enhanced Monitor is set to its default values
which are suitable for use with a dumb terminal. The baud rate is changed to 19200
baud.
If you use the Enhanced Monitor RS-232 port (located on the back of the
mainframe) while the mainframe is in the standby mode, you must supply an
external +5Vdc to the +5VEXT connector (located near the RS-232 port). If you
use the RS-232 port while the mainframe is powered on, you do not need to provide
the external +5Vdc.
#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;
/* 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 = viPrintf(en_mon, "*RST\n");
CHECKERR(errStatus, __LINE__);
/* Set Serial Port Parametersfor use with dumb terminal */
errStatus = viPrintf(en_mon, "SYST:COMM:SER:PRES:TERM");
CHECKERR(errStatus, __LINE__);
/*Status from each VISA call*/
/*Resource mgr. session */
/* Enhanced Monitor session */
Chapter 3

Advertisement

Table of Contents
loading

This manual is also suitable for:

E8404a

Table of Contents