摘要
定时操作在嵌入式软件开发过程中会大量用到,往往通过操作系统自身原生定时服务进行。这些定时器都建立在信号触发、处理的基础上,受定时器个数和信号的限制,实际使用过程中存在一定的局限性,同时代码可移植性较差。提出了一种应用于嵌入式系统或设备的相对定时器方案,利用时钟滴答数组构建专门的定时器模块,为系统其他任务提供定时服务。方案中定时器的数量和精度可以根据运行平台的性能进行动态设定,也可在多个操作系统进行移植,克服了操作系统原生定时服务在使用上的局限性。根据该定时器方案进行了编码实现和精度测试,对不同定时时长、延时时长下的定时误差进行了对比分析,发现误差均在50 ms以内,满足一般情况下的定时误差要求。
Timing operation is widely used in embedded software development,which is usually carried out through the operating system\s own native timing service.These timers are built on the basis of signal triggering and processing,limited by the number of timers and signals,there are some limitations in the actual use process,and the portability is poor.A relative timer scheme applied to embedded system or device is presented,which useing clock tick array to construct special timer module to provide timing service for other tasks in the system.The number and precision of timers in this scheme can be dynamically set according to the performance of the operating platform,and can also be transplanted in multiple operating systems,which overcomes the limitations of the original timing service in the operating system.According to the timer scheme,the coding implementation and precision test are carried out,and the timing errors under different timing duration and delay duration are compared and analyzed.It is found that the errors are all within 50 ms,which meets the requirements of timing errors under the general requirements.
作者
孙彦森
刘金栋
王喜龙
刘雨霞
张静
Sun Yansen;Liu Jindong;Wang Xilong;Liu Yuxia;Zhang Jing(Weichai Power Co.,Ltd.,Weifang,Shandong 261061,China)
出处
《机电工程技术》
2023年第10期329-333,共5页
Mechanical & Electrical Engineering Technology