5-134 Example Program
SR785 Dynamic Signal Analyzer
}
/* ********************************************************************* */
void GetGpib (int address)
// routine to get an answer from a GPIB address
// modify this routine for your GPIB interface
{
char temp[80];
enter (temp,80,&length,address,&status); // enter () is the CEC routine
// to enter a string from an address.
// Sets status = 0 to indicate result OK.
// 80 is maxlen, actual received length
// is stored in &length.
if (status != 0) {
// handle receive errors here
printf ("\nError at device %d : status = %d\n",address,status);
GetSpace ();
}
strcpy (recv, temp); //set global recv string
}
/* ********************************************************************* */
void TxSR785 (char *command)
// Send command to the SR785 and wait until IFC (bit7) is set in
// the Serial Poll status (indicating that the command is finished).
{
TxGpib (SR785,command); // send command to SR785 address
WaitIFC (); //serial poll until IFC set, ok to continue
}
/* ******************************************************************** */
void WaitIFC (void)
{
//serial poll until IFC (bit7) set (command done)
//modify for your GPIB interface
//stb is serial poll byte
char stb;
do {spoll(SR785,&stb,&status);} while (!(stb&128)); //IFC
if (stb&32) {
// If ESB bit set,
// there must be a command error in the Standard Event status word.
// Handle command errors here.
TxGpib (SR785, "*ESR?"); //clear the Standard Event status word
GetGpib (SR785);
printf ("\nEXE error\n");
GetSpace ();
}
}
/* ******************************************************************** */
void GetSR785 (char *getcmd)
// query the SR785 for an answer
// getcmd is the query command string
{
TxSR785 (getcmd); //send query command
GetGpib (SR785); //get response into global recv string
}
/* ******************************************************************** */
void WaitAvg (void)
{
// routine to start a linear avg and wait until both displays are done
int result, avgdone;
Содержание 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 ...