Specifications
300 Chapter 18
PSA Programming Examples
Using C with the CALCulate:DATA:COMPress? RMS Command
PSA Programming Examples
/* Send setup commands to instrument */
viPrintf(viPSA,"%s\n",basicSetup);
/* Calculate sweep time and set it*/
sweeptime=4.6153846*lbursts;
viPrintf(viPSA,":WAV:SWE:TIME %fms\n",sweeptime);
/* Clear status event register */
viQueryf(viPSA,"STAT:OPER:EVENT?\n","%ld",<hrowaway);
/* Initiate the waveform measurement */
viPrintf(viPSA,"INIT:IMM\n");
/* Query the instrument for Operation complete */
viQueryf(viPSA,"*OPC?\n", "%d", &lOpc);
/* Have the instrument calculate the mean RMS I/Q voltage in each burst
(We will convert these discreate values into Mean dBm Power values) */
viPrintf (viPSA, ":CALC:DATA0:COMP? rms,25E-6,526E-6,4.61538461538E-3\n");
/* Serial poll the instrument to determine when Message Available
Status Bit is set. The instrument’s output buffer will then
contain the measurement results*/
i=0;
while(1)
{
i++;
viReadSTB(viPSA,&stb); //read status byte
if (stb & 16) break; //look for message available bit
Sleep (20); // wait 100ms before polling again
}
/*print message to the standard output*/
printf("\nMessage Available statuts bit set after %ld serial poles.\n\n",i);
printf("Getting the burst data in binary format...\nPlease wait...\n\n");