Agilent Technologies E4406A VSA Satellite Radio User Manual


 
144 Chapter 3
Programming Examples
Performing Alignments and Getting Pass/Fail Results
viStatus=viOpen (defaultRM, "GPIB0::18::INSTR", VI_NULL,VI_NULL, &viVSA);
/*check opening session sucess*/
if(viStatus)
{
printf("Could not open a session to GPIB device at address 18!\n");
exit(0);
}
/*increase timeout to 75 sec*/
viSetAttribute(viVSA,VI_ATTR_TMO_VALUE,75000);
/*Lock out the front panel keypad*/
viPrintf(viVSA, "SYST:KLOCK 1\n");
/*reset the analyzer*/
viPrintf(viVSA, "*RST\n");
/*print message*/
printf("The auto-alignement is in progress...\nPlease wait...\n\n");
/*auto-align the analyzer*/
viPrintf(viVSA, "CAL?\n");
/*check for alignement success*/
viScanf (viVSA,"%d",&lCalStatus);
/*alignement succeeds if query result is zero(0)*/
if (!lCalStatus)
/*print success message to standard output*/
printf("The analyzer auto-alignement was successful!\n\n");
else
/*print failure message to standard output*/
printf("The analyzer auto-alignement was not successful!\n\n");
/*Set the Analyzer to Continuous Sweep*/
viPrintf(viVSA, "INIT:CONT 1\n");
/*Unlock the front panel keypad*/
viPrintf(viVSA, "SYST:KLOCK 0\n");
/*reset timeout to 2 sec*/
viSetAttribute(viVSA,VI_ATTR_TMO_VALUE,3000);
/* Close session */
viClose (viVSA);
viClose (defaultRM);
}