Example Programs
G-11
• Any one of the following IEEE-488 interfaces:
Keithley Model KPC-488.2
Keithley Model KPC-488.2AT
Capital Equipment Corporation PC<>488
The program assumes that the Model 2002 is set to address
16.
Linking program with library
After writing and compiling the program, you will have to
link it with the library support files provided with the IEEE-
488 interface. From the DOS prompt, enter the following
command line:
CL myprog.c /link ieee488
The above command line will link your program to the
library. The program can now be run using QuickC.
Program (bintran.c)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ieee-c.h>
#define K2002 16/* IEEE address of 2002 */
main ()
{
int status, l;
char r[80];
float meas;
float dummy;
initialize (21,0);
/* PC controller @ address 2 */
setinputEOS (10); setoutputEOS (10,0);
/* Set EOS for input & ouput */
send (K2002,"*IDN?",&status);
/* Query 2002 for ID string */
enter (r,80,&l,K2002,&status);
/* Get ID string */
printf ("Data received=%s\n",r);
/* Print response. */
send (K2002,"syst:pres",&status);
/* Power Up reset */
send (K2002,"form:elem read",&status);
/* Readings only */
send (K2002,"form:data sre; bord swap",&status);
/* Single precision reals, byte
order swapped. */
while (1) {
/* Loop */
send (K2002,"fetch?",&status);
/* Fetch a reading */
transmit ("MLA TALK 16",&status);
/* Put 2002 in talk mode */
rarray(&meas,5,&l,&status);
/* Get reading */
printf ("Data received=%e\n",meas);
/* Print reading */
}
}
Binary Data Transfer
Microsoft QuickC 2.0
Keithley KPC-488.2 Interface
©1992, Keithley Instruments, Inc.
Description
This program demonstrates the binary data transfer capabil-
ity of the Model 2002. The Model 2002 sends binary read-
ings to the computer using the IEEE754 Single Precision
Data Format.
Required equipment
• Model 2002 Multimeter
• Microsoft QuickC 2.0
Summary of Contents for 2002
Page 123: ...Front Panel Operation 2 106...
Page 145: ...IEEE 488 Reference 3 22...
Page 167: ...IEEE 488 Reference 3 44...
Page 284: ...A Specifications A 1...
Page 362: ......
Page 364: ...This page left blank intentionally...
Page 365: ......