6-34
Remote Programming
/* function prototypes */
void main(int, char *[]);
void txLia(char *);
void initGpib(char *);
void setupLiaForSweep(void);
void printOutBinaryResults();
void printOutIEEEResults();
void printOutLIAResults();
/* National Instruments Interface Function Prototypes (488.1 Calls - see the National software manual).*/
int ibfind(char*);
void ibwrt(int,char *,int);
void ibrd(int,char *,unsigned long);
void ibrsp(int,char *);
void ibeos(int,int);
void ibtmo(int,int);
/* global variables */
int lia; /* SR850 handle */
int rxBuf[6600*2]; /* FAST mode data buffer */
float rfBuf[6600]; /* Floating point data buffer */
void main(int argc, char *argv[])
{
int i,x,y,nPts;
int *ptr;
char tstr[20];
if (argc<2) {
printf("\nUsage: liatest <devName>\n");
exit(1);
}
else
initGpib(SR850);
txLia("OUTX1"); /* Set the SR850 to output responses to the GPIB port */
setupLiaForSweep(); /* Setup the SR850 sweep */
printf("\nAcquiring Data\n");
ibtmo(lia,0); /* turn off timeout for lia or set the timeout longer than the scan. The timeout
measures the time to transfer the full number of bytes, not the time since the
most recent byte is received.*/
txLia("FAST2;STRD"); /* Turn FAST mode data transfer ON, then start scan using the STRD start
after delay command. The STRD command MUST be used if the scan is to be
started by this program! Do NOT use STRT. */
ibrd(lia,(char *)rxBuf,6401L*4L); /* get FAST mode data.
The 100 sec sweep at 64 Hz has 64*100 + 1 points, each point
consists of X (2 bytes) and Y (2 bytes) for a total of 4 bytes. */