分享
分享赚钱 收藏 举报 版权申诉 / 4

类型GPIB编程资料.doc

  • 上传人:hyngb9260
  • 文档编号:7469050
  • 上传时间:2019-05-19
  • 格式:DOC
  • 页数:4
  • 大小:26KB
  • 配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    GPIB编程资料.doc
    资源描述:

    1、GPIB编程资料上面的网页有些 GPIB编程的资料不过 NI的列子是最简单明了的:* Refer to the language interface documentation for details on* which header and .obj files to include in your project.*/#include #include “decl-32.h“#include void GpibError(char *msg); /* Error function declaration */int Device = 0; /* Device unit descriptor

    2、 */int BoardIndex = 0; /* Interface Index (GPIB0=0,GPIB1=1,etc.) */void main() int PrimaryAddress = 2; /* Primary address of the device */int SecondaryAddress = 0; /* Secondary address of the device */char Buffer101; /* Read buffer */* Initialization - Done only once at the beginning of your applica

    3、tion.*/Device = ibdev( /* Create a unit descriptor handle */BoardIndex, /* Board Index (GPIB0 = 0, GPIB1 = 1, .) */PrimaryAddress, /* Device primary address */SecondaryAddress, /* Device secondary address */T10s, /* Timeout setting (T10s = 10 seconds) */1, /* Assert EOI line at end of write */0); /*

    4、 EOS termination mode */if (ibsta ibclr(Device); /* Clear the device */if (ibsta /* Main Application Body - Write the majority of your GPIB code here.*/ibwrt(Device, “*IDN?“, 5); /* Send the identification query command */if (ibsta ibrd(Device, Buffer, 100); /* Read up to 100 bytes from the device *

    5、/if (ibsta Bufferibcntl = 0; /* Null terminate the ASCII string */printf(“%sn“, Buffer); /* Print the device identification */* Uninitialization - Done only once at the end of your application.*/ibonl(Device, 0); /* Take the device offline */if (ibsta ibonl(BoardIndex, 0); /* Take the interface offl

    6、ine */if (ibsta /* Function GPIBERROR* This function will notify you that a NI-488 function failed by* printing an error message. The status variable IBSTA will also be* printed in hexadecimal along with the mnemonic meaning of the bit* position. The status variable IBERR will be printed in decimal*

    7、 along with the mnemonic meaning of the decimal value. The status* variable IBCNTL will be printed in decimal.* The NI-488 function IBONL is called to disable the hardware and* software.* The EXIT function will terminate this program.*/void GpibError(char *msg) printf (“%sn“, msg);printf (“ibsta = p

    8、rintf (“iberr = %d“, iberr);if (iberr = EDVR) printf (“ EDVR n“);if (iberr = ECIC) printf (“ ECIC n“);if (iberr = ENOL) printf (“ ENOL n“);if (iberr = EADR) printf (“ EADR n“);if (iberr = EARG) printf (“ EARG n“);if (iberr = ESAC) printf (“ ESAC n“);if (iberr = EABO) printf (“ EABO n“);if (iberr = E

    9、NEB) printf (“ ENEB n“);if (iberr = EOIP) printf (“ EOIP n“);if (iberr = ECAP) printf (“ ECAP n“);if (iberr = EFSO) printf (“ EFSO n“);if (iberr = EBUS) printf (“ EBUS n“);if (iberr = ESTB) printf (“ ESTB n“);if (iberr = ESRQ) printf (“ ESRQ n“);if (iberr = ETAB) printf (“ ETAB n“);printf (“ibcntl = %ldn“, ibcntl);printf (“n“);/* Call ibonl to take the device and interface offline */ibonl (Device,0);ibonl (BoardIndex,0);exit(1);

    展开阅读全文
    提示  道客多多所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:GPIB编程资料.doc
    链接地址:https://www.docduoduo.com/p-7469050.html
    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    道客多多用户QQ群:832276834  微博官方号:道客多多官方   知乎号:道客多多

    Copyright© 2025 道客多多 docduoduo.com 网站版权所有世界地图

    经营许可证编号:粤ICP备2021046453号    营业执照商标

    1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10.png



    收起
    展开