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

📄 aoloop_insn.c

📁 安装comedi板卡驱动之后的测试程序
💻 C
字号:
//*************************************************************************
//				
//	         Copyright (c) 2001 IAG Software Team, 
//
//		           Beijing R&D Center 
//	
//		           Advantech Co., Ltd.
//
//	      User program for Linux comedi device driver
//
// This is An Unpublished Work Containing Confidential  And Proprietary
//    Information Which Is The Property Of Advantech  Automation Corp.
//
// Any Disclosure, Use, Or Reproduction, Without Written Authorization From
//           Advantech Automation Corp., Is Strictly Prohibit.
//
//
//*************************************************************************
// Program :    aoloop_insn.c
// Revision:    1.0                                        
// Author  :    jingang                                             
// Date    :    09/20/01                                              
//
// Description:  Perform analog output of comedi driver with insn mode.
//				 analog output automaticly loop.                             
//-------------------------------------------------------------------------

#include <stdio.h>	
#include <comedilib.h>
#include <time.h>

int subdev = 1;		/* change this to your input subdevice */
int chan = 3;		/* change this to your channel */
int range = 0;		/* more on this later */
int aref = AREF_GROUND;	/* more on this later */

int main(int argc,char *argv[])
{
	comedi_t *it;
	lsampl_t data;
	time_t time1, time2;
	
	data = 0xfff;//4095;
	
	it=comedi_open("/dev/comedi0");
	time(&time1);
	while(1) {	
		//data +=1000;
		comedi_data_write(it,subdev,chan,range,aref,data & 0xffff);
		time(&time2);
		if (time2 - time1 > 50)
			break;
	}
//	comedi_data_write(it,subdev,chan,range,aref,0);	
	return 0;
}

⌨️ 快捷键说明

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