Stanford Research Systems SR844 User Manual page 138

Rf lock-in amplifier
Table of Contents

Advertisement

4-36 Example Program
void main (void) {
// *******************************************************************
// You can see the commands received by the SR844 using the [Setup] key
// to show the receive queue on the displays. The hex values of the received
// characters will be shown.
// *******************************************************************
int nPts,nCount,i,j,test;
double xval, yval, rval, pval;
double ch1val, ch2val;
printf ("\nSR844 Example Program\n");
// ***** Initialize your GPIB card here *****
initialize (21,0);
// ***** Set the SR844 output interface to GPIB! *****
TxSr844 ("*CLS");
TxSr844 ("OUTX1"); // Direct SR844 responses to GPIB interface.
// ***** Set the Standard Event Enable register to catch EXE and CMD
// Command errors will set the ESB bit in the Serial Poll Status
TxSr844 ("*ESE48"); // set bits 4 and 5
// ***** Check communication by querying the SR844 IDN string
GetSr844 ("*IDN?");
printf ("[GPIB IDN] = %s\n", recv);
printf ("Reset SR844...");
TxSr844 ("*RST");
printf ("done\n"); // Communication parameters are unchanged.
TxSr844("REST");
TxSr844("SRAT10; SEND0");
TxSr844("DDEF1,0; DDEF2,0");
printf ("Initialization done ... Change settings here if desired.");
GetSpace ();
// *******************************************************************
// ***** Read outputs normally *****
// Read values sequentially. If the outputs are changing rapidly, the values
// of X,Y,R and phase may not agree.
// OUTP does not include the output expand.
GetSr844 ("OUTP?1"); xval = atof(recv);
GetSr844 ("OUTP?2"); yval = atof(recv);
GetSr844 ("OUTP?3"); rval = atof(recv);
GetSr844 ("OUTP?5"); pval = atof(recv);
printf ("OUTP? :\n");
printf ("
printf ("
%14.6E
// **********
// Read display values (including expands). These values are read sequentially.
GetSr844 ("OUTR?1"); ch1val = atof(recv);
GetSr844 ("OUTR?2"); ch2val = atof(recv);
printf ("OUTR? :\n");
printf ("
printf ("
%14.6E
// **********
// Read X,Y,R,phase simultaneously. These values agree much better for rapidly
// changing outputs.
GetSr844 ("SNAP?1,2,3,5");
sscanf (recv,"%lf,%lf,%lf,%lf",&xval,&yval,&rval,&pval);
printf ("SNAP? :\n");
SR844 RF Lock-In Amplifier
// Clear all status registers.
// Reset the SR844 to the default state.
// Pause to change setup.
X
Y
%14.6E
%14.6E
CH1
CH2 \n");
%14.6E\n", ch1val, ch2val);
// Reset data buffers.
// Set sample rate (64 Hz), stop at end.
// Buffers store CH1 (X) and CH2 (Y) displays
// read X
// read Y
// read R
// read phase
R
%14.6E\n", xval, yval, rval, pval);
// read CH1 display (with expand)
// read CH2 display (with expand)
// Read X,Y,R,phase at same time.
// Result is a string with 4 values separated
// by commas.
Phase \n");

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents