我是用Agilent VISA程序库,按照visa手册对vc进行设置,粘了一个实现IDN?功能的程序,编译链接没问题,但执行试并没有得到仪器名称。仪器在visa assistant中已经查到并能实现idn?功能。程序如下:
/*idn.c
This example program queries a GPIB device for an iden
tification string
and prints the results. Note that you must change the address. */
#include <visa.h>
#include <stdio.h>
void main () {
ViSession defaultRM, vi;
char buf [256] = {0};
/* Open session to GPIB device at address 22 */
viOpenDefaultRM (&defaultRM);
viOpen (defaultRM, "GPIB0::22::INSTR", VI_NULL,VI_NULL, &vi);
/* Initialize device */
viPrintf (vi, "*RST
");
/* Send an *IDN? string to the device */
viPrintf (vi, "*IDN?
");
/* Read results */
viScanf (vi, "%t", &buf);
/* Print results */
printf ("Instrument id string: %s
", buf);
/* Close session */
viClose (vi);
viClose (defaultRM);
}
一周热门 更多>