Agilent Technologies E4406A VSA Programming Examples, Saving and Recalling Instrument State Data

Models: E4406A VSA

1 406
Download 406 pages 63.49 Kb
Page 140
Image 140
Manual background

Programming Examples

Saving and Recalling Instrument State Data

#include <stdio.h> #include <stdlib.h> #include <conio.h> #include "visa.h"

void main ()

{

/*program variables*/ ViSession defaultRM, viVSA; ViStatus viStatus= 0;

/*open session to GPIB device at address 18 */ viStatus=viOpenDefaultRM (&defaultRM);

viStatus=viOpen (defaultRM, "GPIB0::18::INSTR", VI_NULL,VI_NULL, &viVSA); /*check opening session sucess*/

if(viStatus)

{

printf("Could not open a session to GPIB device at address 18!\n"); exit(0);

}

/*set the instrument to basic mode*/ viPrintf(viVSA, "INST BASIC\n"); /*reset the instrument */ viPrintf(viVSA, "*RST\n");

/*set the input port to the internal 50Mhz reference source*/ viPrintf(viVSA, "SENS:FEED AREF\n");

/*zoom the spectrum display*/ viPrintf(viVSA, "DISP:FORM:ZOOM1\n"); /*tune the analyzer to 50MHZ*/ viPrintf(viVSA, "SENS:FREQ:CENT 50E6\n"); /*change the resolution bandwidth*/ viPrintf(viVSA, "SENS:SPEC:BAND:RES 100E3\n"); /*change the Y Axis Scale/Div*/

viPrintf(viVSA, "DISP:SPEC:WIND:TRAC:Y:SCAL:PDIV 5\n"); /*Change the display refernece level*/ viPrintf(viVSA, "DISP:SPEC:WIND:TRAC:Y:SCAL:RLEV -15\n"); /*trigger the instrument*/

140

Chapter 3

Page 140
Image 140
Agilent Technologies E4406A VSA manual Programming Examples, Saving and Recalling Instrument State Data