52 Programming Examples
SR620 Universal Time Interval Counter
Program Example 5
IBM PC, Microsoft C v5.1, CEC GPIB Card
This example illustrates binary transfer via the GPIB in C. The file MS-C488.h must be included in the source
file and the program must be linked to the file GPIB-L.OBJ. Both of these files are supplied by CEC.
/* Program to test TIC binary dump mode- this program will binary dump samples
from the time interval counter and convert the binary values to numbers in
units appropriate to the measurement mode. The program also demonstrates
sending and receiving simple commands from the TIC. The program uses the GPIB
interface using an IBM PC with a Capital Equipment Co. GPIB Interface card.
The necessary interface routines to this card are supplied by CEC and are
linked to the program.
This program is written in Microsoft C version 5.1. The header file for the
GPIB interface is ms-c488.h and is supplied by CEC.
To compile this program use the command: CL /AL /FPi /c bindump.c .
The resulting object file is then linked with GPIB-L.OBJ (from CEC) and
the emulation math library. (which doesn't assume a math coprocessor) */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ms-c488.h>
#include <dos.h>
#define sr620 16
/* TIC address */
void main(void);
void InitGpib (void);
void TxGpib (int,char *); /* function prototypes */
void GetGpib (int);
void StatCheck (int);
void TalkGpib (int);
void Convert (int,int,int);
int status,length,mode,count;
char recv[80];
/* the data from each point is stored in 4 consecutive array locations */
int data[20000]; /* up to 5000 points */
double fdata[5000]; /* data storage for converted data */
void main ()
{
char cmd[40],input[40];
int i,samples,seg,tmode,texpd;
static char *units[] ={"s","s","s","Hz","s","deg","ct"};
InitGpib ();
/* initialize controller */
while (1)
{
/* read number of samples */
printf ("Enter number of samples (<cr> to quit) ->");
gets
(input);
Содержание SR620
Страница 2: ...SR620 Universal Time Interval Counter...
Страница 6: ...iv Table of Contents SR620 Universal Time Interval Counter...
Страница 8: ...vi Safety and Preparation for Use SR620 Universal Time Interval Counter...
Страница 12: ...x Specifications SR620 Universal Time Interval Counter...
Страница 58: ...42 Programming Commands SR620 Universal Time Interval Counter...
Страница 72: ...56 Programming Examples SR620 Universal Time Interval Counter...
Страница 76: ...60 Troubleshooting Tips SR620 Universal Time Interval Counter...
Страница 82: ...66 Performance Test SR620 Universal Time Interval Counter...
Страница 90: ...74 Calibration Procedure SR620 Universal Time Interval Counter...
Страница 102: ...86 Circuit Description SR620 Universal Time Interval Counter...
Страница 124: ...108 Parts List SR620 Universal Time Interval Counter...