Specifications
SR400 with the GPIB Interface
56
PROGRAM EXAMPLE 4:
IBM PC, MICROSOFT C V4.0, VIA GPIB
This program requires the Capital Equipment Corporation GPIB card for the IBM PC. It has firmware in
ROM to interface high level languages to the GPIB.
The header file MS-C488.H contains definitions of all of the CEC firmware routines which can be called from
C. Note that the order of arguments in the calls are reversed from those used by BASIC.
To use these routines, the large model must be used. Compile with the /AL/Ze switch and link with GPIB-
L.OBJ (on the CEC disk).
/* Compile with >MSC program name/AL/Ze;
link with GPIB-L.OBJ (on CEC disk)
include MS-C488.H
MS-C488.H defines all of the CEC firmware routines so that they
can be called from a C program. Remember that the order of the
arguments is REVERSED from the BASIC calls described in the manual.
Example program to read the SR400 counter data and ramp the PORT1
analog output using Microsoft C v4.0 (large model) and the Capital
Equipment Corp. GPIB interface card.
Set the SR400 for GPIB ADDR=23.
*/
#include <ms-c488.h>
#include <stdio.h>
char result[80];
main()
{
int i,status,sr400=23;
int my_address=21, system_controller=0;
char cmd[80], portstr[40];
long n1;
float x;
initialize(&system_controller, &my_address); /* init GPIB controller */
/* clear SR400 */
transmit(&status, "IFC UNT UNL REN MTA LISTEN 23 SDC");
Statcheck(status);
for (i=0;i<1000;i++); /* wait for clear to finish */
/* set counter A to 10 Mhz */
TxGpib(sr400,"CI0,0");