当前位置: 首页 > news >正文

怎样做淘宝的导购网站wordpress prepare

怎样做淘宝的导购网站,wordpress prepare,域名注册域名详细流程,网站建设专题[摘要] Timer是实时操作系统的一个重要组成部分。本文结合近阶段的学习和实验情况#xff0c;对VxWorks中的时间函数和定时器作了一些探讨。主要介绍了Timer的机制#xff0c;相关的函数#xff0c;并给出了一些具体的例子。 一. Tick Tick是指每秒中定时器中断的次数。POS…[摘要] Timer是实时操作系统的一个重要组成部分。本文结合近阶段的学习和实验情况对VxWorks中的时间函数和定时器作了一些探讨。主要介绍了Timer的机制相关的函数并给出了一些具体的例子。 一. Tick Tick是指每秒中定时器中断的次数。POSIX标准中tick等于50即每20ms定时器中断一次。VxWorks中tick的缺省设置为60。因为实时操作系统中任务的调度和定时器密切相关tick设置是否合理对整个系统性能的影响是很明显的。如果tick太小则系统实时响应能力较差反之如果tick太大则会使得系统的绝大多数资源浪费在不断的任务管理和调度中。 Tick的次数在userconfig.c文件中设置其语句为sysClkRateSet (60)。用户可以更改这个文件然后重新编译BSP库也可以在应用程序中更改。 和tick相关的函数主要有 sysClkRateGet 得到每秒系统的tick数 sysClkRateSet 设置系统的tick数 二. 看门狗时钟Watchdog Timer Watchdog Timer 提供了这样一种机制它使一个C函数和一个时间延迟联系起来。当该时间延迟到达以后系统会调用该C函数。Watchdog Timer采用了中断服务进程ISR的机理当C函数被激活时它是作为ISR运行的。 和Watchdog Timer相关的函数如下 wdCreate 创建Watchdog Timer wdDelete 删除Watchdog Timer wdStart 启动一个Watchdog Timer wdCancel 取消一个正在记数的Watchdog Timer Watchdog使用过程如下首先调用wdCreate创建一个Watchdog Timer, 然后通过wdStart启动该Timer。当tick累计到设定的数字时和它相联系的C函数被激活作为ISR运行。下面是一个例子该例子在延迟3秒后输出一句话“Watchdog timer just expired”。 例 #include VxWorks.h #include logLib.h #include wdLib.h #include taskLib.h /* defines */ #define  SECONDS (3) WDOG_ID myWatchDogId; myTask (void) {  /* Create watchdog */ if ((myWatchDogId wdCreate()) NULL) return (ERROR); /* Set timer to go off in SECONDS - printing a message to stdout */ if (wdStart (myWatchDogId, sysClkRateGet() * SECONDS, logMsg, Watchdog timer just expired\n) ERROR) taskDelay(200); return (ERROR); }  三.POSIX Timer VxWorks提供了和POSIX1003.1b兼容的时间机制。和POSIX Timer相关的主要函数如下 clock_gettime 取得当前时间 clock_settime 设置当前时间 timer_create 创建定时器 timer_connect 将定时器和某个C 函数相连接 timer_cancel 取消某个定时器 timer_delete 删除定时器 timer_settime 设置Timer的中断周期 下面是POSIX Timer的例子。该例子中myTimer()用来初始化Timer将myHandler()和tmID Timer相关联。每隔1秒myHandler()被调用一次。当myHandler()被调用10次后它取消并删除定时器tmID。 POSIX Timer中定义了两个重要的结构它们都在time.h文件中定义。其定义如下 struct timespec { /* interval tv_sec*10**9 tv_nsec */ time_t tv_sec;                 /* seconds */ long tv_nsec;            /* nanoseconds (0 - 1,000,000,000) */ }; struct itimerspec { struct timespec it_interval;          /* timer period (reload value) */ struct timespec it_value;             /* timer expiration*/ }; 例子见附录。 四.小结 VxWorks目前并没有向我们提供系统的文档及开发资料所有的资料只有连机帮助。帮助中对各个系统函数也只作了一个简单的介绍对函数中的输入、输出、返回值以及函数中用到的各种结构、宏定义都没有说明。本文中提供的例子及对函数的理解都是通过实验得出的可能会有曲解或错误的地方欢迎大家批评指正。 为了测试系统函数编制了一些小程序如有兴趣者可和我联系。 VxWorks中并没有系统地讲述其时间机制而是分散在帮助文件的各个地方有兴趣者可参见以下章节 ²  Tornado 1.0.1 online Manuals - VxWorks Programmer’s Guide - Basic Os - Watchdog Timers ²  Tornado 1.0.1 online Manuals - VxWorks Programmer’s Guide- Basic Os - POSIX Clock and Timers ²  Tornado 1.0.1 online Manuals - VxWorks Reference - Libraries and Drivers - ClockLib ²  Tornado 1.0.1 online Manuals - VxWorks Reference - Libraries and Drivers - sysLib ²  Tornado 1.0.1 online Manuals - VxWorks Reference - Libraries and Drivers - tickLib ²  Tornado 1.0.1 online Manuals - VxWorks Reference - Libraries and Drivers - timerLib 五.附录 vxtimer.c /****************************************************************************** 标题: vxtimer.c 功能: VxWorks timer test programm. 说明: This is a test program for VxWorks. In function myTimer, the timer handler--myHandler is connect to the timer tmId. Once the timer reaches the set time, myHandler will be called. It will display some infomration on the screen. To run this program, just compile it and do as follows: ldvxtimer.o sp myTimer 作者: An Yunbo 日期: 1999/7/14           ******************************************************************************/ #include VxWorks.h #include time.h #include timers.h #include syslib.h #include logLib.h #include stdio.h #define COUNT 10 /****************************************************************************** 标题: myhandler 功能: the timer handler. it will be called once the set time is reachted. 格式void myHandler(timer_t tmId, int arg). 输入 timer_t tmId: the Id of the set timer. int arg. A user parameter. 输出 返回值 ******************************************************************************/ void myHandler(timer_t tmId,int arg) { static int iCount0; int iRet; iCount; printf(myHandler is called. the arg is      %d,count is %d\n,arg,iCount); /* When this funciton is called COUNT times, cancle the timer and delete it. */ if(iCountCOUNT) { iRettimer_cancel(tmId); if(iRet!0) { printf(time_cancel error.\n); return; } printf(Timer cancled\n); timer_delete(tmId); if(iRet!0) { printf(time_delete error.\n); return; } } } /************************************************************************* 标题myTimer 功能init timId and connect it with function myHandler. 格式void myTimer(). 输入 输出 返回值 *************************************************************************/ void myTimer() { int iRet; struct timespec     stTp0,stTp1; struct itimerspec stValue; timer_t tmId; /* set current time to 0 second and o nsecond*/ stTp0.tv_sec0; stTp0.tv_nsec0; iRetclock_settime(CLOCK_REALTIME, stTp0); if(iRet!0) { printf(clock_settime error.\n); return; } iRettimer_create(CLOCK_REALTIME,NULL,tmId); iRettimer_create(0,NULL,tmId); if(iRet!0) { printf(timer_create error.\n); return; } /* connect tmId with myHandler*/  iRettimer_connect(tmId,myHandler,10); if(iRet!0) { printf(timer_connect error.\n); return; } /* set interrupt time: 1 second and the first interrup time will be 2 second later */ stValue.it_interval.tv_sec1; stValue.it_interval.tv_nsec0; stValue.it_value.tv_sec2; stValue.it_value.tv_nsec0; iRettimer_settime(tmId,0,stValue,0); if(iRet!0) { printf(timer_settime error.\n); return; } /* sleep 10 second and print the remind time when the time interrupt come*/ stTp0.tv_sec10; stTp0.tv_nsec0; while(1) { nanosleep(stTp0,stTp1); printf(tv_sec %ld tv_nsec %ld\n,stTp1.tv_sec,stTp1.tv_nsec); } }
http://www.zqtcl.cn/news/671080/

相关文章:

  • 中山快速做网站价格网站投稿源码
  • 免费网站建设教程青岛网站建设收费哪个平台好
  • 关于网站建设外文文献金蝶软件多少钱一套
  • 有高并发量门户网站开发经验国家商标局官网查询
  • 正规的招聘网站可信网站标志
  • 网站举报能不能查到举报人佛山企业网站建设电话
  • 家居网站建设如何现在去长沙会被隔离吗
  • 电子烟网站建设win2008iis7配置网站
  • 做网站的是什么职业微信公众号模板素材网站
  • 重庆川九建设有限责任公司官方网站成都网站海口网站建设
  • 珠宝 网站模板如何做公司官网
  • 贵阳网站制作免费iis7.5网站权限配置
  • 温州网站建设专业的公司移动互联网开发学什么专业
  • 集团企业网站建设方案运动服饰网站建设项目规划书
  • 简述网站建设的一般步骤简约的网站建设
  • wordpress删除用户头像昆明做网站优化的公司
  • 西安响应式网站网页设计的模板
  • 古装衣服店网站建设页面网站执行速度
  • 哪里的网站建设哈尔滨网络优化推广公司
  • 给网站做友情链接凡科网干嘛的
  • 网站经常出现502牧星网站建立
  • 个人网站建设的收获dw网站导航怎么做
  • 徐州网站设计快速排名网站
  • dede手机网站跳转口碑营销平台
  • 开一个素材设计网站怎么做的网页传奇手机版
  • 网站开发后端框架什么意思树莓派3 部署wordpress
  • 站长之家最新域名查询合肥网站建设5k5
  • h5做网站什么软件北京公司注销流程及费用
  • 淮北市相山区建设局网站合肥比较好的网站制作
  • 松岗营销型网站建设公司网站需要服务器吗