6-33
Remote Programming
EXAMPLE PROGRAM 1
Using Microsoft C (v5.1) with the National Instruments GPIB card
on the IBM PC.
To successfully interface the SR850 to a PC via the GPIB interface, the instrument, interface card, and inter-
face drivers must all be configured properly. To configure the SR850, the GPIB address must be set in the
SYSTEM SETUP menu. The default GPIB address is 8; use this address unless a conflict occurs with other
instruments in your system. The SR850 will be set to GPIB address 8 whenever a reset is performed (power
on with the [<-] key down).
Make sure that you follow all the instructions for installing the GPIB card. The National Instruments card
cannot be simply unpacked and put into your computer. To configure the card you must set jumpers and
switches on the card to set the I/O address and interrupt levels. You must run the program "IBCONF" to con-
figure the resident GPIB driver for you GPIB card. Please refer to the National Instruments manual for infor-
mation. In this example, the following options must be set with IBCONF:
Device name: LIA
Device address: 8
Terminate Read on EOS: No (for binary transfers)
Once all the hardware and GPIB drivers are configured, use "IBIC". This terminal emulation program allows
you to send commands to the SR850 directly from your computer's keyboard. If you cannot talk to the SR850
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 SR850. After you are familiar with these simple commands,
you can explore more complex programming commands.
/*******************************************************************************************************/
/* Example program using Microsoft C V5.1 and the National Instruments GPIB card.
Connect the Sine Out to the A Input with a BNC cable.
Run this program by typing the program name followed by a space and the device name.
The device name is the name used in IBCONF to configure the National Instruments driver.
For example, if the program is called LIATEST and the above configuration is used,
then type LIATEST LIA.
The program will configure the SR850 to sweep the internal oscillator from 10 to 100 Hz in 100 sec-
onds. The line notch (50/60 Hz) filter will be engaged. As the frequency is swept, the response of the
notch filter is graphed.
Binary X and Y data will be transferred to the PC during the sweep using the FAST transfer command.
After the sweep is complete, the existing magnitude (R) data in the data buffer will be transferred in
IEEE floating point format as well as the LIA non-normalized floating point format (faster transfer) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "decl.h"
#define SR850 argv[1]