Download iMAG LTS Multi-Channel SQUID System
Transcript
iMAG 303 Multi-Channel SQUID System
GPIB Example Programs
The following are sample “C” language DOS programs written for the iMC-303 Controller.
TEST2.C is a simple program which verifies the communications link between the iMC-303 Controller and the
host computer.
/* TEST2.c - A simple GPIB test program for the iMC-303 using National
Instruments GPIB library */
#include "decl.h"
#include <stdio.h>
#include <string.h>
int handle;
char inbuf[80];
int i;
/* DOS GPIB header file */
void main(void)
{
handle = ibfind("DEV15");
/* connect to device */
if ( handle < 0 )
{
printf("error - no connection established");
return;
}
ibtmo(handle,11);
/* set timeout to 1 seconds */
ibwrt(handle,"*IDN?;",6);
/* query device ident.
*/
for(i=0;i<10000;i++) i=i*i;
/* delay loop
*/
ibrd(handle,inbuf,80);
/* read response
*/
inbuf[strlen(inbuf)] = '\0';
/* null terminate string
*/
printf("Connected to: %s \n",inbuf);
}
/* end of TEST2.C */
Tristan Technologies
Page 67