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

📄 gpiomeas.c

📁 HP GPIB的VB和C语言库文件,参考范例.
💻 C
字号:
/* gpiomeas.c 
   This program does the following: 
   - Creates a GPIO session with timeout and error checking
   - Signals the device with a CTL0 pulse
   - Reads the device's response using formatted I/O
*/

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

main()
{
   INST id;       /* interface session id */
   float result;  /* data from device */

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

   /* log message and exit program on error */
   ionerror(I_ERROR_EXIT);

   /* open GPIO interface session, with 3-second timeout */
   id = iopen("gpio");
   itimeout(id, 3000);

   /* setup formatted I/O configuration */
   igpiosetwidth(id, 8);
   igpioctrl(id, I_GPIO_READ_EOI, '\n');

   /* monitor the device's PSTS line */
   igpioctrl(id, I_GPIO_CHK_PSTS, 1);

   /* signal the device to take a measurement */
   itrigger(id);

   /* get the data */
   iscanf(id, "%f%*t", &result);
   printf("Result = %f\n", result);

   /* close session */
   iclose (id);

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

   return 0;
}

⌨️ 快捷键说明

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