为了使嵌入式软件代码更加可靠,增强程序的可维护性,将有限状态机理论应用于嵌入式设计中。论述了有限状态机的基本结构和它的基本原理,介绍了有限状态机建模在嵌入式系统中实际应用现状。针对一种实际按键模块的需要,利用有限状态机的嵌入式设计建立了系统模型。采用状态机实现方法编写了按键接口程序,实现了2个按键的状态机模型设计。系统的调试结果验证了模型的正确性和可靠性,具有一定的工程价值。
In order to make the code of embedded software more reliable,and to enhance the maintainability of the program,the theory of finite state machine is applied in embedded design.This paper discusses the finite state machine and its principle,introduced the state machine programming in embedded systems and characteristics of the practical application;then prepared by the state machine implementations of the key interface,that reduce the complexity of the system and improve the quality and reliability of the software.