⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hpibstat.c

📁 HP GPIB的VB和C语言库文件,参考范例.
💻 C
字号:
/* hpibstat.c
   The following example retrieves and displays
   HP-IB bus status information.
*/

#include <stdio.h>
#include <sicl.h>

main()
{
   INST id;                 /* session id        */
   int rem;                 /* remote enable     */
   int srq;                 /* service request   */
   int ndac;                /* not data accepted */
   int sysctlr;             /* system controller */
   int actctlr;             /* active controller */
   int talker;              /* talker            */
   int listener;            /* listener          */
   int addr;                /* bus address       */

   #if defined(__BORLANDC__) && !defined(__WIN32__)
      _InitEasyWin();   // required for Borland EasyWin programs
   #endif

   /* exit process if SICL error detected */
   ionerror(I_ERROR_EXIT);

   /* open HP-IB interface session */
   id = iopen("hpib7");
   itimeout (id, 10000);

   /* retrieve HP-IB bus status */
   igpibbusstatus(id, I_GPIB_BUS_REM,      &rem);
   igpibbusstatus(id, I_GPIB_BUS_SRQ,      &srq);
   igpibbusstatus(id, I_GPIB_BUS_NDAC,     &ndac);
   igpibbusstatus(id, I_GPIB_BUS_SYSCTLR,  &sysctlr);
   igpibbusstatus(id, I_GPIB_BUS_ACTCTLR,  &actctlr);
   igpibbusstatus(id, I_GPIB_BUS_TALKER,   &talker);
   igpibbusstatus(id, I_GPIB_BUS_LISTENER, &listener);
   igpibbusstatus(id, I_GPIB_BUS_ADDR,     &addr);

   /* display bus status */
   printf("%-5s%-5s%-5s%-5s%-5s%-5s%-5s%-5s\n", "REM", "SRQ",
         "NDC", "SYS", "ACT", "TLK", "LTN", "ADDR");
   printf("%2d%5d%5d%5d%5d%5d%5d%6d\n", rem, srq, ndac, 
          sysctlr, actctlr, talker, listener, addr);

/* For WIN16 programs, call _siclcleanup before exiting to release
   resources allocated by SICL for this application.  This call
   is a no-op for WIN32 programs. */
   _siclcleanup();

   return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -