摘要
单片机通常采用递归或嵌套结构进行多级菜单设计,但使用多级菜单选择可能的状态及管理状态之间的转换时设计的复杂度较高。为此,提出一种基于状态机的多级菜单设计方法,将菜单的不同层级和状态转换通过状态机的状态、事件和转换规则来表达,实现了利用Enter和Set两个按键来完成复杂菜单的操作。通过这种方式,不仅简化了菜单的设计与实现,而且提高了系统的扩展性与可维护性,该方法在饮水机系统中取得了良好的应用成效。
Microcontrollers typically use recursive or nested structures for multi-level menu design,however,the design complexity increases when selecting possible states and managing transitions between these states within multi-level menus.To address this issue,a design method for multilevel menus based on a state machine is proposed.In this approach,different menu levels and state transitions are expressed through the states,events,and transition rules of the state machine,enabling the operation of complex menus using just two buttons:Enter and Set.By adopting this method,not only is the design and implementation of menus simplified,but the system′s scalability and maintainability are also enhanced.This method has achieved favorable application results in the water dispenser system.
作者
陶莹莹
王超越
朱辉
TAO Yingying;WANG Chaoyue;ZHU Hui(School of Physics and Electronic Engineering,Fuyang Normal University,Fuyang,Anhui 236000,China)
出处
《自动化应用》
2025年第18期236-238,共3页
Automation Application
基金
安徽省高校自然科学重大项目(2023AH040065)
2024安徽省电子信息高峰培育学科子项目(AHPV202412)。
关键词
状态机
嵌入式设备
多级菜单
state machine
embedded devices
multilevel menus