EasyManua.ls Logo

Agilent Technologies Agilent 3499A

Agilent Technologies Agilent 3499A
357 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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);
}

Table of Contents