|
发表于 2010-5-27 20:17:03
|
显示全部楼层
下面是Agilent的SICL的一个例子,差别很大,对吧?
/* gpibdev.c
This example program sends a scan list to a
switch and, while looping, closes channels and
takes measurements. */
#include <sicl.h>
#include <stdio.h>
main()
{
INST dvm;
Using SICL with GPIB 4
Agilent SICL User’s Guide 91
INST sw;
double res;
int i;
/* Log message and terminate on error */
ionerror (I_ERROR_EXIT);
/* Open the multimeter and switch sessions*/
dvm = iopen (“gpib0,9,3”);
sw = iopen (“gpib0,9,14”);
itimeout (dvm, 10000);
itimeout (sw, 10000);
/*Set up trigger*/
iprintf (sw, “TRIG:SOUR BUS\n”);
/*Set up scan list*/
iprintf (sw,”SCAN (@100:103)\n”);
iprintf (sw,”INIT\n”);
for (i=1;i<=4;i++)
{
/* Take a measurement */
iprintf (dvm,”MEAS:VOLT:DC?\n”);
/* Read the results */
iscanf (dvm,”%lf”,&res);
/* Print the results */
printf (“Result is %lf\n”,res);
/* Trigger to close channel */
iprintf (sw, “TRIG\n”);
}
/* Close the multimeter and switch sessions */
iclose (dvm);
iclose (sw);
return 0;
} |
|