Specifications
180 Chapter 16
ESA/PSA Programming Examples
Using C to Serial Poll the Analyzer to Determine when an Auto-alignment is
Complete
ESA/PSA Programming Examples
long lResult = 0;
long lOpc = 0;
char cEnter = 0;
/*open session to GPIB device at address 18 */
viStatus=viOpenDefaultRM (&defaultRM);
viStatus=viOpen (defaultRM, "GPIB0::18::INSTR", VI_NULL,VI_NULL,&viPSA);
/*check opening session sucess*/
if(viStatus)
{
printf("Could not open a session to GPIB device at address 18!\n");
exit(0);
}
/*increase timeout to 60 sec*/
viSetAttribute(viPSA,VI_ATTR_TMO_VALUE,60000);
/*Clear the analyzer*/
viClear(viPSA);
/*Clear all event registers*/
viPrintf(viPSA, "*CLS\n");
/* Set the Status Event Enable Register */
viPrintf(viPSA, "*ESE 1\n");
/*Initiate self-alignment*/
viPrintf(viPSA, "CAL:ALL\n");
/* Send the Operation complete command so that the
stand event register will be set to 1 once
the pending alignment command is complete */
viPrintf(viPSA, "*OPC\n");
/* print message to standard output */