Example
Program
5-131
SR785 Dynamic Signal Analyzer
// ****** set the Standard Event enable register to catch EXE and CME
// Command errors will set the ESB bit in the Serial Poll status word
TxSR785 ("*ESE 48"); //set bits 4 and 5
// ****** Check communication by querying SR785 IDN string
GetSR785 ("*IDN?");
printf ("[GPIB IDN] = %s\n\n", recv);
printf ("Reset SR785...");
TxSR785 ("*RST"); // reset the SR785 to a default state
printf ("done\n\n");
/* ***************************************************** */
/* ****** set up FFT averaging for both displays ******* */
TxSR785 ("FAVM 2,1"); //display avg = rms
TxSR785 ("FAVT 2,0"); //type = linear
TxSR785 ("FAVN 2,250"); //number = 250
TxSR785 ("FAVG 2,1"); //avg = On
TxSR785 ("SRCO 1"); // turn on the source
// ****** query these parameters for DisplayA ******
GetSR785 ("FAVM? 0"); mode = atoi(recv);
GetSR785 ("FAVT? 0"); type = atoi(recv);
GetSR785 ("FAVN? 0"); number = atoi(recv);
printf ("Disp Avg = %d : type = %d : number = %d\n\n",mode,type,number);
printf ("Avg start...");
WaitAvg ();
//start a linear average and wait until done
printf ("done\n");
TxSR785 ("ASCL 0; ASCL 1"); //autoscale the displays
/* ***************************************************** */
/* ****** read data points ****** */
dispAVal = GetData (0,40); //read DisplayA bin 40 (peak)
dispBVal = GetData (1,40); //read DisplayB bin 40
printf ("DisplayA = %lf dBVpk\n",dispAVal);
printf ("DisplayB = %lf dBVpk\n",dispBVal);
/* ***************************************************** */
/* ****** Binary transfer all of DisplayA spectrum ****** */
//We need to send the DSPB?0 command WITHOUT waiting for
//IFC in serial poll status since IFC will not be set until
//AFTER the transfer is complete!
//This section needs to be modified for your GPIB interface
printf ("\nReading entire DisplayA...");
TxGpib (SR785,"DSPB? 0"); //use TxGpib (don't wait for IFC)
transmit ("MLA TALK 10", &status); //make the PC listen, SR785 talk
rarray (rxBuff, 1604, &length, &status); //binary read 1604 bytes
//401 points x 4 bytes/point
WaitIFC (); //serial poll until IFC set, ok to continue
printf ("%d bytes read\n",length); //actual number of bytes read
// ****** print a few points from the spectrum
for (i=37; i<44; i++) {printf ("bin %d = %f dBVpk\n", i, rxBuff[i]);}
printf ("\n");
/* ***************************************************** */
/* ****** Turn on limit testing ****** */
TxSR785 ("LCLR 0"); //first clear any existing limits for DisplayA
TxSR785 ("LMAX 0,2"); //initialize 2 segments
TxSR785 ("LSEG 0,0,0,12.032E3,-90.0,102.4E3,-90.0"); //upper segment
TxSR785 ("LSEG 0,1,0,1.28E3,-90.0,8.96E3,-90.0"); //upper segment
Содержание SR785
Страница 4: ...ii ...
Страница 10: ...viii ...
Страница 80: ...1 64 Exceedance Statistics ...
Страница 158: ...2 78 Curve Fitting and Synthesis SR785 Dynamic Signal Analyzer ...
Страница 536: ...5 136 Example Program SR785 Dynamic Signal Analyzer ...