摘要
工业控制中广泛使用单片机作为核心控制器。随着控制系统复杂性的不断提升,单片机的单任务运行机制难以胜任复杂的控制任务。本文针对单任务机制的局限性,研究了嵌入式系统中多任务机制的原理,分析了实现多任务机制的基本条件,提出了实施多任务机制的策略,然后将多任务程序运行机制引入单片机系统,设计了一个基于分时机制的具有一定优先级规则的多任务系统,并使用C语言编写了程序。该程序可读性好、运行效率高、易于调试维护,满足了多任务系统的运行需求,在STM32系统上实现了多任务运行机制。
Microcontroller Unit(MCU) is widely used as a core controller in industrial production.As the complexity of the control system continues to increase,the single-function operation mechanism of MCU cannot handle complex control tasks.In view of the limitations of the single-task mechanism,this paper studies the implementation principle of multi-task mechanism in embedded systems,analyzes the basic conditions for implementing multi-task mechanism,and proposes a multitask implementation strategy.Then the multi-task program running mechanism is introduced into MCU,and a multi-tasking system with certain priority rules based on time-sharing mechanism is designed.The program is written in C language.The program is readable,efficient,easy to debug and maintain meets the operation requirements of multi-tasking system,and realizes multi-task operation mechanism on STM32 system.
作者
唐飞
杨伟
TANG Fei;YANG Wei(School of Physics and Electronics,Anqing Normal University,Anqing 246133,China)
出处
《安庆师范大学学报(自然科学版)》
2019年第4期70-74,共5页
Journal of Anqing Normal University(Natural Science Edition)
基金
安徽省自然科学研究基金(AQKJ2014B018)