Agilent Technologies Model A.08.xx Water Dispenser User Manual


 
118 Chapter 3
Programming Examples
Reading Trace Data using ASCII Format (GPIB)
void main()
{
/*Program Variable*/
ViStatus viStatus = 0;
/*Dimension cResult to 13 bytes per sweep point, 8192 sweep points maximum*/
ViChar _VI_FAR cResult[106496] = {0};
FILE *fTraceFile;
static ViChar *cToken ;
int iNum =0;
int iSwpPnts = 401;
long lCount=0L;
long lOpc=0;
/*iNum set to 13 times number of sweep points, 8192 sweep points maximum*/
iNum =106496;
lCount =0;
/* Open a GPIB session at address 18*/
viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM,"GPIB0::18",VI_NULL,VI_NULL,&viESA);
if(viStatus)
{
printf("Could not open a session to GPIB device at address 18!\n");
exit(0);
}
/* Clear the instrument */
viClear(viESA);
/*Reset the instrument. This will set number of sweep points to default of 401*/
viPrintf(viESA,"*RST\n");
/*Display the program heading */
printf("\n\t\t Read in Trace Data using ASCII Format (GPIB) Program \n\n" );
/* Check for the instrument model number and route the 50MHz signal accordingly*/
Route50MHzSignal();
/*Query number of sweep points per trace (firmware revision A.04.00 and later)*/
/*For firmware revisions prior to A.04.00, the number of sweep points is 401*/
iSwpPnts = 401;
viQueryf(viESA,"SENSE:SWEEP:POINTS?\n","%d",&iSwpPnts);
/*Set the analyzer center frequency to 50MHz*/
viPrintf(viESA,"SENS:FREQ:CENT 50 MHz\n");
/*Set the analyzer to 50MHz Span*/