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


 
Chapter 3 127
Programming Examples
Reading Trace Data Using ASCII Format (RS-232)
{
/*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=0L;
/*iNum set to 13 times number of sweep points, 8192 sweep points maximum*/
iNum =106496;
lCount =0;
/* Open a serial session at COM1 */
viStatus=viOpenDefaultRM(&defaultRM);
if (viStatus =viOpen(defaultRM,"ASRL1::INSTR",VI_NULL,VI_NULL,&viESA) !=
VI_SUCCESS)
{
printf("Could not open a session to ASRL device at COM1!\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\tRead in Trace Data using ASCII Format (RS232) 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*/
viPrintf(viESA,"SENS:FREQ:SPAN 50 MHz\n");