291
Chapter 8 Application Programs
Visual C++ Example Program
4
8
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
// Change 0 to 1 if RS-232 interface
// is to be used.
# 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;
// Session to default resource manager.
ViSession vi;
// Session to instrument.
ViStatus status;
// VISA function status return code.
char retStr[128];
// String returned from the instrument.
/* 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);
}
Summary of Contents for Agilent 3499A
Page 13: ...1 1 Quick Start ...
Page 27: ...2 2 Front Panel Operation ...
Page 55: ...3 3 System Overview ...
Page 77: ...4 4 Features and Functions ...
Page 113: ...5 5 Remote Interface Reference ...
Page 164: ...164 5 ...
Page 165: ...6 6 Error Messages ...
Page 173: ...7 7 Plug in Modules ...
Page 256: ...256 Chapter 7 Plug in Modules 44475A Breadboard Module 7 ...
Page 261: ...261 Chapter 7 Plug in Modules 44476B Microwave Switch Module 4 7 The 44476B is shown below ...
Page 286: ...286 Chapter 7 Plug in Modules Terminals and Connections Information 7 ...
Page 288: ...288 7 ...
Page 289: ...8 8 Application Programs ...
Page 299: ...9 9 Specifications ...
Page 343: ...343 Chapter 9 Specifications 44475A Breadboard Module 4 9 ...