Example Program
4-35
SR844 RF Lock-In Amplifier
// ************************************************************************
// Example program using Microsoft C v7.0 and
// the Capital Equipment Corp CEC488 interface card.
// To use another interface card, modify the GPIB subroutines
// where indicated.
// The SR844 is assumed to be at address 8 (default).
// Link this object file with ieee488.lib provided by CEC
// (or the library for your GPIB card).
// ************************************************************************
// Connect the REF OUT to the SIGNAL IN
// ************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <math.h>
#include <ieee-c.h>
// This is the CEC header file
// Use the .h file for your interface card.
// send(), enter(), transmit(), rarray(), tarray(),
// spoll(), initialize(), settimeout() are routines
// defined in ieee-c.h.
// ************************************************************************
#define
sr844 8
// address of SR844
int
status, length;
// CEC routines use these
char
recv[80];
// global GPIB receive string
char
cmd[80];
// global GPIB command string
int
FastBuf[1600];
// Fast Transfer Mode buffer (2 ints per point, X&Y)
int
rLiaBuf[1600];
// LIA float buffer (ch1) (2 ints per point)
int
pLiaBuf[1600];
// LIA float buffer (ch2) (2 ints per point)
float
rfBuf[800];
// IEEE binary buffer (ch1) (1 float per point)
float
pfBuf[800];
// IEEE binary buffer (ch2) (1 float per point)
char
rAscBuf[10][20];
// ASCII string buffer (ch1)
char
pAscBuf[10][20];
// ASCII string buffer (ch2)
double fscale[15] = {1.0E-7, 3.0E-7, 1.0E-6, 3.0E-6, 1.0E-5, 3.0E-5, 1.0E-4, 3.0E-4,
1.0E-3, 3.0E-3, 1.0E-2, 3.0E-2, 1.0E-1, 3.0E-1, 1.0};
// array of full scale sensitivities in Volts
int
sens;
// sensitivity number [0-14]
// ************************************************************************
// Subroutines at the end of this listing
// ************************************************************************
// GPIB interface subroutines
// You may need to modify these for your interface card!
void TxGpib (int, char *);
// transmit string to device
void GetGpib (int);
// receive string from device
void TxSr844 (char *);
// transmit string to SR844, wait for IFC
void GetSr844 (char *);
// transmit query string to SR844 (wait for IFC),
// and get receive string
void WaitIFC (void);
// wait for IFC status in SR844 (command complete)
// ************************************************************************
void GetSpace (void);
// pause and wait for space bar
double xLIA (int,int);
// translate LIA float data to real values
double xBin (int,int);
// translate IEEE binary data
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...