Example
Program
5-135
SR785 Dynamic Signal Analyzer
avgdone=0; //init avgdone status
GetSR785 ("DSPS?"); //clear sticky bits in Display status word first
TxSR785 ("STRT"); //start lin average measurement
do {
GetSR785 ("DSPS?"); result=atoi(recv); //read display status word
avgdone = avgdone | (result & 0x0202);
//Check for AVGA and AVGB status bits until both have occurred.
//Remember, they may not be set together in the same query!
//Do not check for both in the same query!
}
while ((avgdone&0x0202)!=0x0202); // both AVGA and AVGB have occurred
}
/* ******************************************************************** */
double GetData (int disp, int bin)
{
//routine to move the display marker to a bin and return the data value
//move the marker in display disp to bin
sprintf (cmd,"MBIN %d,%d",disp,bin);
TxSR785 (cmd);
sprintf (cmd,"DSPY? %d,%d",disp,bin); //read the data value at bin
GetSR785 (cmd);
return (atof(recv)); //return the value as a double
}
/* ******************************************************************** */
void GetSpace (void) /* Wait for space key */
{
char ch;
while ( kbhit() ) getch(); // clear the keyboard buffer
printf ("\n<Space> to continue, <Q> to quit ");
do {
ch = (char) getch ();
if ((ch == 'q')||(ch =='Q')) exit(0); // exit
}
while (ch!=' '); // continue
printf ("\n");
}
/* ******************************************************************* */
Содержание 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 ...