Visual C++ Example Program - Agilent Technologies Agilent 3499A User Manual

Switch/control system
Hide thumbs Also See for Agilent 3499A:
Table of Contents

Advertisement

Visual C++ Example Program

This example program is written in Visual C++ 6.0 and has been tested
on a PC running WIN95/NT. The example uses the SCPI commands. As
the example is currently written, the program requirements are:
GPIB interface selected and set to the address of 09 from the front-
panel;
Any one of the relay modules installed in Slot 1 of the mainframe;
A GPIB interface card installed in your PC with the VISA library.
To program a 3499A/B/C using the RS-232 interface, you will need to
modify the code at the top of the program. Change the line
# define USING_RS232 0 to # define USING_RS232 1. On the
3499A/B/C, select the RS-232 interface and set its parameters to: BAUD
RATE (9600), PARITY (NONE, 8 BITS), and FLOW (FLOW NONE). A
GPIB card in your PC is not necessary if you are using RS-232.
# include <stdio.h>
# include <windows.h>
# include "visa.h"
# define USING_RS232 0
# if USING_RS232
# define INST_ADDR"ASRL1::INSTR"// 3499A/B/C RS-232 address.
# else
# define INST_ADDR"GPIB0::9::INSTR"// 3499A/B/C GPIB address.
# endif
void main()
{
ViSession drm;
ViSession vi;
ViStatus status;
char retStr[128];
/* Open the default resource manager. */
status = viOpenDefaultRM( &drm );
if ( status < VI_SUCCESS ) {
printf( "VISA ERROR: viOpenDefaultRM()\n");
exit(1);
}
/* Open a session to the 3499A/B/C. */
status = viOpen( drm, INST_ADDR, VI_NULL, VI_NULL, &vi );
if ( status < VI_SUCCESS ) {
printf( "VISA ERROR: viOpen(). Address: %s\n",INST_ADDR);
viClose( drm );
exit(1);
}
Chapter 8 Application Programs
Visual C++ Example Program
// Change 0 to 1 if RS-232 interface
// is to be used.
// Session to default resource manager.
// Session to instrument.
// VISA function status return code.
// String returned from the instrument.
4
8
291

Advertisement

Table of Contents
loading

This manual is also suitable for:

Agilent 3499cAgilent 3499b

Table of Contents