EasyManuals Logo

Agilent Technologies EMC Series Programmer's Guide

Agilent Technologies EMC Series
349 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
Page #134 background imageLoading...
Page #134 background image
134 Chapter 3
Programming Examples
Reading Trace Data Using 32-bit Real Format (RS-232)
/*Calculate size of trace record. This will be the sum of HeaderBytes, Number*/
/*Bytes (the actual data bytes) and the "\n" terminator*/
iSize = lNumberBytes + iHeaderBytes + 1;
/*Increase timeout to 60 sec*/
viSetAttribute(viESA,VI_ATTR_TMO_VALUE,60000);
/*Set RS-232 interface to terminate when the buffer is empty*/
viSetAttribute(viESA,VI_ATTR_ASRL_END_IN,VI_ASRL_END_NONE);
/*Get trace header data and trace data*/
viPrintf(viESA,"TRAC:DATA? TRACE1\n");
viRead (viESA,(ViBuf)cResult,iSize,&lRetCount);
/*Reset timeout to 3 sec*/
viSetAttribute(viESA,VI_ATTR_TMO_VALUE,3000);
/*Extract the trace data*/
memcpy(dTraceArray,cResult+iHeaderBytes,(size_t)lNumberBytes);
/*Save trace data to an ASCII file*/
fTraceFile=fopen("C:\\temp\\ReadTrace32Rs232.txt","w");
fprintf(fTraceFile,"ReadTrace32Rs232.exe Output\nHewlett-Packard 1999\n\n");
fprintf(fTraceFile,"The %d trace data points of the
spectrum:\n\n",(lNumberBytes/4));
for ( long i=0;i<lNumberBytes/iBytesPerPnt;i++)
fprintf(fTraceFile,"\tAmplitude of point[%d] = %.2lf
dBm\n",i+1,dTraceArray[i]);
fclose(fTraceFile);
/*Close the session*/
viClose(viESA);
viClose(defaultRM);
}

Table of Contents

Other manuals for Agilent Technologies EMC Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Agilent Technologies EMC Series and is the answer not in the manual?

Agilent Technologies EMC Series Specifications

General IconGeneral
BrandAgilent Technologies
ModelEMC Series
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals