Stanford Research Systems SR844 User Manual page 143

Rf lock-in amplifier
Table of Contents

Advertisement

// ************************************************************************
void GetSpace (void) {
// Wait for space bar pressed.
char ch;
while ( kbhit() ) getch(); // Clear keyboard buffer.
printf ("\n<Space> to continue, <Q> to quit >");
do {
ch = (char) getch();
if ( (ch=='q')||(ch=='Q') ) exit(0);
}
while (ch != ' ');
printf ("\n");
}
// ************************************************************************
double xBin (int quant, int index)
{
// Returns double result from FAST mode array (integer X and Y data).
// See FAST command description for more details.
// quant selects X, Y, R or Phase to be returned
double x,y;
x = (double)FastBuf[2*index]/29788.0;
y = (double)FastBuf[2*index+1]/29788.0;
x = x * fscale[sens];
y = y * fscale[sens];
switch (quant) {
case 1: return (sqrt(x*x + y*y));
case 2: return (atan2(y,x) * 57.2958); // Compute theta from X and Y
case 3: return (x);
case 4: return (y);
default: return (0.0);
}
}
// ************************************************************************
double xLIA (int chan, int index)
{
// Returns double result from LIA float arrays.
// See TRCL command description for more details.
int mant,exp;
double val;
if ( chan==1 ) {
mant = rLiaBuf[2*index];
exp
= rLiaBuf[2*index+1] - 124; // Then the binary exponent (16 bits)
val
}
if ( chan==2 ) {
mant = pLiaBuf[2*index];
exp
= pLiaBuf[2*index+1] - 124; // Then the binary exponent (16 bits)
val
}
return (val);
}
// ************************************************************************
// Until space bar
// CONVERT to voltage
// by multiplying by full scale input voltage.
= (double) mant * pow(2.0,(double) exp);
= (double) mant * pow(2.0,(double) exp);
Example Program 4-41
// exit
// 29788 is full scale
// Compute R from X and Y
// channel 1
// First comes the mantissa (16 bits)
// offset by 124
// channel 2
// First comes the mantissa (16 bits)
// offset by 124
SR844 RF Lock-In Amplifier

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents