38
PROGRAMMING EXAMPLES
Example 1
IBM PC, Microsoft C Ver. 5.1 Using the National Instruments GPIB Interface.
To successfully interface the FS700 to a PC via the GPIB interface, the instrument, interface card,
and interface drivers must all be configured properly. To configure the FS700, the GPIB address
must be set in the SETUP menu. The default GPIB address is 17; use this address unless a conflict
occurs with other instruments in your system. The FS700 will be set to GPIB address 17 whenever a
reset is performed (power on with the BSP key down).
Follow all the instructions for installing the GPIB card. The National Instruments card cannot be simply
unpacked and put into the computer. To configure the card set jumpers and switches on the card to
set the I/O address and interrupt levels. Run the program "IBCONF" to configure the resident GPIB
driver for the GPIB card. Please refer to the National Instruments manual for information. In the
example below, the FS700 is installed as a device named "LORAN".
Once all the hardware and GPIB drivers are configured, use "IBIC". This terminal emulation program
allows you to send commands to the FS700 directly from the computer's keyboard. If you cannot talk
to the FS700 via "IBIC", then your programs will not run.
Use the simple commands provided by National Instruments. Use "IBWRT" and "IBRD" to write and
read from the FS700. After you are familiar with these simple commands, explore more complex
programming commands.
The example program uses the GRIP command to set the GRI and the STRT command to start a
search. The GRIP? query is used to read back the GRI.
/* Example program using Microsoft C V5.1 and the National Instruments GPIB card */
/* This program assumes that the FS700 is installed as device "loran" using IBCONF */
#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<stdlib.h>
#include"decl.h"
/* National Instruments Header File */
void main(void);
int
ibfind(char *);
/* Function Prototypes for GPIB Calls */
void
ibwrt(int,char *,int);
void ibrd(int,char
*,int);
void main(void)
{
int i;
int FS700;
char tstr[20];