Chapter 3 151
Programming Examples
Status Register–Determine When a Measurement is Done
printf ("\t\nWaiting for an SRQ to be generated ...");
for (lCount =0;(lCount<10) && (iSrqOccurred ==0); lCount++)
{
long lCount2 =0;
printf(".");
while ((lCount2++ < 100) && (iSrqOccurred ==0))
{
YIELD;
}
}
printf("\n");
}
/*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*/
/*E4401B, E4411B and E7401A*/
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");
scanf( "%c",&cEnter);
/*Externally route the 50MHz Signal*/
viPrintf(viESA,"CAL:SOUR:STAT ON \n");
}
}
/*Interrupt handler,trigger event handler */
ViStatus _VI_FUNCH mySrqHdlr(ViSession viESA, ViEventType eventType, ViEvent
ctx,ViAddr userHdlr)
{
ViUInt16 iStatusByte;