4-40
Example Program
SR844 RF Lock-In Amplifier
// ************************************************************************
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 if result is ok.
// 80 is maximum string length.
// 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 receive string
}
// ************************************************************************
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));
// spoll() is the CEC serial poll routine.
// The value of the Serial Poll register is
// stored in stb.
// Test bit 1 (IFC) until set.
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?");
// Clear the Standard Event Status
GetGpib (sr844);
// by reading it.
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);
// Send command to SR844 address
WaitIFC ();
// Wait until IFC set again, ok to continue
}
// ************************************************************************
void GetSr844 (char *getcmd) {
// Query the SR844 for a response.
// getcmd is the query command string.
TxSr844 (getcmd);
// Send query command, wait for command to execute.
GetGpib (sr844);
// Get response into global receive string (recv).
}
Summary of Contents for SR844
Page 10: ...viii SR844 RF Lock In Amplifier...
Page 12: ...1 2 Getting Started SR844 RF Lock In Amplifier...
Page 32: ...2 2 SR844 Basics SR844 RF Lock In Amplifier...
Page 60: ...3 2 Operation SR844 RF Lock In Amplifier...
Page 102: ...3 44 Shift Functions SR844 RF Lock In Amplifier...
Page 108: ...4 6 Index of Commands SR844 RF Lock In Amplifier...
Page 144: ...4 42 Example Program SR844 RF Lock In Amplifier...
Page 146: ...5 2 Performance Tests SR844 RF Lock In Amplifier...
Page 150: ...5 6 Performance Tests SR844 RF Lock In Amplifier...
Page 156: ...5 12 Performance Tests SR844 RF Lock In Amplifier...
Page 158: ...5 14 Performance Tests SR844 RF Lock In Amplifier...
Page 162: ...5 18 Performance Tests SR844 RF Lock In Amplifier...
Page 166: ...5 22 SR844 Test Record SR844 RF Lock In Amplifier...
Page 168: ...6 2 Circuitry Parts Lists and Schematics SR844 RF Lock In Amplifier...
Page 246: ...Parts Lists SR844 RF Lock In Amplifier 6 80 Schematic Diagrams...