Chapter 3
131
Programming Examples
Reading Trace Data Using 32-bit Real Format (RS-232)
/* - Query the trace data */
/* TRAC:DATA? TRACE1 */
/* - Reset VISA timeout to 3 seconds */
/* - Remove the "," from the ACSII data */
/* - Save the trace data to an ASCII file */
/* - Close the session */
/************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
#include "visa.h"
#define hpESA_IDN_E4401B "Hewlett-Packard, E4401B"
#define hpESA_IDN_E4411B "Hewlett-Packard, E4411B"
#definehpEMC_IDN_E7401A "Hewlett-Packard, E7401A"
ViSession defaultRM, viESA;
ViStatus errStatus;
ViChar cIdBuff[256]= {0};
char cEnter = 0;
int
iResult = 0;
/*Set the input port to 50MHz amplitude reference*/
void Route50MHzSignal()
{
viQueryf(viESA, "*IDN?\n", "%t", &cIdBuff);
iResult = (strncmp( cIdBuff, hpESA_IDN_E4401B, strlen(hpESA_IDN_E4401B)) &&
strncmp( cIdBuff, hpESA_IDN_E4411B, strlen(hpESA_IDN_E4411B)) && strncmp( cIdBuff,
hpEMC_IDN_E7401A, strlen(hpEMC_IDN_E7401A)));
if( iResult == 0 )
{
/*Set the input port to the 50MHz amplitude reference for the models*/
/*E4411B and E4401B*/
viPrintf(viESA,"CAL:SOUR:STAT ON \n");
}
else
{
/* For the analyzers having frequency limits >= 3GHz, prompt the user to*/
/* connect the amplitude reference output to the input*/
printf ("Connect AMPTD REF OUT to the INPUT \n");
printf ("......Press Return to continue \n");