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

📄 display.c

📁 rtai-3.1-test3的源代码(Real-Time Application Interface )
💻 C
字号:
/*COPYRIGHT (C) 2000  Paolo Mantegazza (mantegazza@aero.polimi.it)This library is free software; you can redistribute it and/ormodify it under the terms of the GNU Lesser General PublicLicense as published by the Free Software Foundation; eitherversion 2 of the License, or (at your option) any later version.This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNULesser General Public License for more details.You should have received a copy of the GNU Lesser General PublicLicense along with this library; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.*/#include <stdio.h>#include <stdlib.h>#include <rtai_mbx.h>#include <rtai_msg.h>static RT_TASK *task;int main(void){	fd_set input;	struct timeval tv;	unsigned int msg, ch;	MBX *mbx;	struct sample { long long min; long long max; int index; } samp;	tv.tv_sec = 0; 	if (!(task = rt_task_init(nam2num("LATCHK"), 20, 0, 0))) {		printf("CANNOT INIT MASTER TASK\n");		exit(1);	} 	if (!(mbx = rt_get_adr(nam2num("LATMBX")))) {		printf("CANNOT FIND MAILBOX\n");		exit(1);	}	while (1) {		rt_mbx_receive(mbx, &samp, sizeof(samp));		printf("*** min: %d, max: %d average: %d  <Hit [RETURN] to stop> ***\n", (int) samp.min, (int) samp.max, samp.index);		FD_ZERO(&input);		FD_SET(0, &input);		tv.tv_usec = 20000;	        if (select(1, &input, NULL, NULL, &tv)) {			ch = getchar();			break;		}	}	rt_rpc(rt_get_adr(nam2num("LATCAL")), msg, &msg);	rt_task_delete(task);	exit(0);}

⌨️ 快捷键说明

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