Specifications

Chapter 18 295
PSA Programming Examples
Using C to Make a Power Calibration Measurement for a GSM Mobile
Handset
PSA Programming Examples
while(1)
{
viReadSTB(viVSA,&stb); //read status byte
if (stb & 128) break; //look for "waiting for trigger" bit
printf("Waiting on Analyzer...\n");
Sleep (50); // wait 50 ms between each serial poll
}
/*print message to the standard output*/
printf("Analyzer is Ready!\n\nWaiting for phone to trigger...\n\n");
/*Querry for Operation Complete */
viQueryf(viVSA,"*OPC?\n", "%d", &lOpc);
/*Use the CALC:DATA0:COMP command to return the average power in each burst*/
viPrintf(viVSA,":CALC:DATA2:COMP? DME,25E-6,526E-6,%f\n",burstinterval);
/* get number of bytes in length of postceeding data and put this in sBuffer*/
viRead (viVSA,(ViBuf)sBuffer,2,&lBytesRetrieved);
printf("Getting the burst data in binary format...\n\n");
/* Put the returned data into sBuffer */
viRead (viVSA,(ViBuf)sBuffer,sBuffer[1] - 0,&lBytesRetrieved);
/* append a null to sBuffer */
sBuffer[lBytesRetrieved] = 0;
/* convert sBuffer from ASCII to integer */
lNumberBytes = atoi(sBuffer);
/*calculate the number of returned values given the number of bytes.
REAL 64 binary data means each number is represented by 8 bytes */
lNumberPoints = lNumberBytes/sizeof(ViReal64);
/*get and save returned data into an array */
viRead (viVSA,(ViBuf)adDataArray,lNumberBytes,&lBytesRetrieved);