Example Program
4-41
SR844 RF Lock-In Amplifier
// ************************************************************************
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);
// exit
}
while (ch != ' ');
// Until space bar
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; // 29788 is full scale
y = (double)FastBuf[2*index+1]/29788.0;
x = x * fscale[sens];
// CONVERT to voltage
y = y * fscale[sens];
// by multiplying by full scale input voltage.
switch (quant) {
case 1: return (sqrt(x*x + y*y));
// Compute R from X and 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 ) {
// channel 1
mant = rLiaBuf[2*index];
// First comes the mantissa (16 bits)
exp = rLiaBuf[2*index+1] - 124; // Then the binary exponent (16 bits)
// offset by 124
val
= (double) mant * pow(2.0,(double) exp);
}
if ( chan==2 ) {
// channel 2
mant = pLiaBuf[2*index];
// First comes the mantissa (16 bits)
exp = pLiaBuf[2*index+1] - 124; // Then the binary exponent (16 bits)
// offset by 124
val
= (double) mant * pow(2.0,(double) exp);
}
return (val);
}
// ************************************************************************
Содержание SR844
Страница 10: ...viii SR844 RF Lock In Amplifier...
Страница 12: ...1 2 Getting Started SR844 RF Lock In Amplifier...
Страница 32: ...2 2 SR844 Basics SR844 RF Lock In Amplifier...
Страница 60: ...3 2 Operation SR844 RF Lock In Amplifier...
Страница 102: ...3 44 Shift Functions SR844 RF Lock In Amplifier...
Страница 108: ...4 6 Index of Commands SR844 RF Lock In Amplifier...
Страница 144: ...4 42 Example Program SR844 RF Lock In Amplifier...
Страница 146: ...5 2 Performance Tests SR844 RF Lock In Amplifier...
Страница 150: ...5 6 Performance Tests SR844 RF Lock In Amplifier...
Страница 156: ...5 12 Performance Tests SR844 RF Lock In Amplifier...
Страница 158: ...5 14 Performance Tests SR844 RF Lock In Amplifier...
Страница 162: ...5 18 Performance Tests SR844 RF Lock In Amplifier...
Страница 166: ...5 22 SR844 Test Record SR844 RF Lock In Amplifier...
Страница 168: ...6 2 Circuitry Parts Lists and Schematics SR844 RF Lock In Amplifier...
Страница 246: ...Parts Lists SR844 RF Lock In Amplifier 6 80 Schematic Diagrams...