7-12 Chapter7
Programming Examples
Measurement Setup Examples
570 !
580 ! Channel 4 Transmitted Power measurement
590 OUTPUT @Nwa;”CHAN4;MEASB;”
600 OUTPUT @Nwa;”LOGM;AUTO;” ! Channel 4 log magnitude and autoscale
610 !
620 OUTPUT @Nwa;”SPLID4;” ! Display as four separate graticules
630 !
640 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
650 ENTER @Nwa;Reply ! Read the 1 when complete
660 LOCAL @Nwa ! Release HP-IB control
670 END
Visual C++ Program Listing
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include “visa.h”
#include “875x_cpp.h”
ViStatus initialize(ViRsrc Nwa, ViBoolean id_query, ViBoolean do_reset, ViPSession
vi_ptr);
ViStatus checkErr(ViSession vi, ViStatus err_status);
/***************************************************************************/
/* hp875x Instrument Driver EXAMPLE #1A */
/* */
/* This program demonstrates setup of various measurement parameters such */
/* as start frequency, stop frequency, etc. The program first selects one */
/* type of measurement to be viewed using dual-channel display format. */
/* The specified start and stop frequencies are then programmed and the */
/* analyzer display is autoscaled. The program concludes by displaying */
/* four types of measurements simultaneously. */
/***************************************************************************/
int main ()
{
ViSessionvi;
ViStatuserr_status;
ViRsrc nwa;
ViReal64 f_start;
ViReal64 f_stop;
ViBoolean reply;
printf(“Example 1a --\n”);
printf(“This program demonstrates setup of various measurement parameters such\n”);
printf(“as start frequency, stop frequency, etc. The program first selects one\n”);
printf(“type of measurement to be viewed using dual-channel display format.\n”);
printf(“The specified start and stop frequencies are then programmed and the\n”);
printf(“analyzer display is autoscaled. The program concludes by displaying\n”);
printf(“four types of measurements simultaneously.\n\n”);
nwa = “GPIB0::16::INSTR”;
// Initialize the instrument
initialize(nwa, VI_FALSE, VI_TRUE, &vi);
// Set the timeout to 3000 msec (3 sec)