5-132 Example Program
SR785 Dynamic Signal Analyzer
TxSR785 ("LTST 0,1"); //turn on testing
// ****** take a new measurement
printf ("Avg start...");
WaitAvg ();
printf ("done\n");
GetSR785 ("LFAL?0"); //read limit test result
printf ("Limit test = ");
if (atoi(recv)==0) printf ("pass"); else printf ("fail");
printf ("\n\n");
// ****** clean up
TxSR785 ("LCLR 0"); //clear limits, turn off testing
TxSR785 ("FAVG 2,0"); //turn avg off
/* ***************************************************** */
/* ****** Load the arbitrary waveform buffer ****** */
// construct a normalized ramp of 2048 points
// each point is a 4 byte IEEE float between -1.0 and +1.0
for (i=0; i<2048; i++) { txBuff[i] = ((float) i)/2048.F; }
//This section needs to be modified for your GPIB interface
printf ("Loading Arb buffer...");
TxGpib (SR785,"ALOD? 2048"); //use TxGpib so we don't wait for IFC
//SR785 will return a binary 1 to acknowledge
transmit("mla talk 10",&status); //make SR785 a talker, pc a listener
rarray (&ack, 4, &length, &status); //binary read 4 bytes (long int)
//return value should be 1
printf ("%d bytes recvd [val=%ld]...",length,ack);
transmit("mta listen 10",&status); //make SR785 a listener, pc a talker
tarray(txBuff,8192,1,&status); //binary transfer of 8192 bytes to SR785
//(2048 points x 4 bytes/point)
//set EOI with last byte
WaitIFC (); //serial poll until IFC set, ok to continue
printf ("done\n");
TxSR785 ("STYP 3"); //change source type to Arb
TxSR785 ("I1RG 4; I2RG 4"); //increase the input ranges
TxSR785 ("FSPN 2,3.2E3"); //narrow the span to display the spectrum
GetSpace (); //pause to look
/* ***************************************************** */
/* ****** Switch to Octave Analysis ****** */
TxSR785 ("STYP 2"); //switch to Noise source
TxSR785 ("NTYP 2"); //choose Pink noise
TxSR785 ("MGRP 2,2"); //switch to Octave measurement group
printf ("\n\nWait for octave settle...");
GetSR785 ("DSPS?"); //clear any sticky bits in the Display status word
//and then wait until the settle bits become set
do { GetSR785 ("DSPS?"); } while ( (atoi(recv)&0x0404) != 0x0404 );
printf ("done\n\n");
TxSR785 ("SVTR 0,5"); //save DisplayA to Trace5
TxSR785 ("RCTR 1,5"); //recall Trace5 to DisplayB
GetSR785 ("DSPN? 1"); nlen = atoi(recv); //query the length of DisplayB
printf ("DisplayB length = %d\n",nlen);
/* ***************************************************** */
/* ****** Download an octave trace ****** */
// Make Trace5 a constant -27 dBVpk for all bins.
// Convert -27 dBVpk to Volts (10^(-27/20))=0.04467
// Trace5 is already defined as an Octave measurement
// so the downloaded points are assumed to be Volts squared!
Содержание 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 ...