116
Chapter 3
Programming Examples
Reading Trace Data using ASCII Format (GPIB)
Reading Trace Data using ASCII Format (GPIB)
/************************************************************/
/* Reading Trace Data using ASCII Format (GPIB) */
/* */
/* This example is for the E44xxB ESA Spectrum Analyzers */
/* and E740xA EMC Analyzers. */
/* */
/* This C programming example does the following. */
/* The required SCPI instrument commands are given as */
/* reference. */
/* */
/* - Opens a GPIB session at address 18 */
/* - Clears the Analyzer */
/* - Resets the Analyzer */
/* *RST */
/* - Set the input port to the 50 MHz amplitude reference */
/* E4411B or E4401B */
/* CAL:SOUR:STAT ON */
/* E4402, E4403B, E4404BE, 4405B, E4407B or E4408B */
/* Prompt to connect AMPTD REF OUT to INPUT */
/* CAL:SOUR STAT ON */
/* - Query for the number of sweep points (only applies to */
/* firmware revisions A.04.00 and later); default is 401 */
/* SENS:SWE:POIN? */
/* - Sets the analyzer center frequency to 50 MHz */
/* SENS:FREQ:CENT 50 MHZ */
/* - Sets the analyzer span to 50 MHz */
/* SENS:FREQ:SPAN 50 MHZ */
/* - Set the analyzer to single sweep mode */
/* INIT:CONT 0 */
/* - Trigger a sweep and wait for sweep to complete */
/* INIT:IMM;*WAI */
/* - Specify units in dBm */
/* UNIT:POW DBM */
/* - Set the analyzer trace data to ASCII */
/* FORM:DATA: ASC */
/* - Trigger a sweep and wait for sweep to complete */
/* INIT:IMM;*WAI */
/* - Query the trace data */
/* TRAC:DATA? TRACE1 */
/* - Remove the "," from the ACSII data */
/* - Save the trace data to an ASCII file */
/* - Close the session */