Stanford Research Systems SR844 User Manual page 142

Rf lock-in amplifier
Table of Contents

Advertisement

4-40 Example Program
// ************************************************************************
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);
if (status != 0) {
// Handle receive errors here
printf ("\nError at device %d : status = %d\n", address, status);
GetSpace ();
}
strcpy (recv, temp);
}
// ************************************************************************
void WaitIFC (void) {
// Serial poll the SR844 until IFC (bit 1) is set (command done).
// Modify for your GPIB interface.
char stb;
do {spoll (sr844,&stb,&status);} while (!(stb&2));
if (stb&32) {
// If ESB bit set (bit 5 in Serial Poll)
// there must be a command error in the Standard Event Status!
// Handle command errors here.
TxGpib (sr844, "*ESR?");
GetGpib (sr844);
printf ("\nEXE error\n");
GetSpace ();
}
}
// ************************************************************************
void TxSr844 (char *command) {
// Send command to the SR844 and wait until command executes
// (IFC set in the Serial Poll register).
TxGpib (sr844, command);
WaitIFC ();
}
// ************************************************************************
void GetSr844 (char *getcmd) {
// Query the SR844 for a response.
// getcmd is the query command string.
TxSr844 (getcmd);
GetGpib (sr844);
}
SR844 RF Lock-In Amplifier
// enter() is the CEC routine to enter
// a string from an address.
// Sets status=0 if result is ok.
// 80 is maximum string length.
// Actual received length is stored in &length.
// Set global receive string
// spoll() is the CEC serial poll routine.
// The value of the Serial Poll register is
// stored in stb.
// Test bit 1 (IFC) until set.
// Clear the Standard Event Status
// by reading it.
// Send command to SR844 address
// Wait until IFC set again, ok to continue
// Send query command, wait for command to execute.
// Get response into global receive string (recv).

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents