当前位置:网站首页>Blue Bridge Cup multi interface switching processing (enumeration plus state machine method)
Blue Bridge Cup multi interface switching processing (enumeration plus state machine method)
2022-07-01 12:08:00 【Proficient in embedded】
List of articles
Preface
In this paper, we mainly introduce how to deal with the problem of multi interface switching in the Blue Bridge Cup .
One 、 What is multi interface switching
Multi interface switching is that the title requires a specific interface to be displayed in the case of characteristics , At this time, we need to switch the interface .
Two 、 Code display
#include <STC15F2K60S2.H>
static void DIP_ser(void)// Handling multiple interfaces
static void key_scan(void);// Press the key to switch the interface
typedef enum
{
ID_NULL=0,
ID_1,// Interface 1
ID_2,// Interface 2
ID_3,// Interface 3
}ID_DATA;
ID_DATA id_data;// Declare an enumeration variable
void DIP_ser(void)
{
switch(id_data)
{
case ID_1:
{
// Interface 1 Function main body
}
break;
case ID_2:
{
// Interface 2 Function main body
}
break;
case ID_3:
{
// Interface 3 Function main body
}
break;
}
}
void key_scan(void)
{
// Operate enumeration variables to achieve interface switching
( There is no need to explain this part of the code , Press the key to change id_data that will do )
}
void main()
{
id_data=ID_1;// Power on initialization interface 1( You can also change to other interfaces )
while(1)
{
key_scan();
DIP_ser();
}
}
summary
Using this method to switch the interface is simple and clear , The code will look clearer .
边栏推荐
- 91. (cesium chapter) cesium rocket launch simulation
- Dlhsoft Kanban, Kanban component of WPF
- Use set_ Handler filters out specific SystemC wrapping & error messages
- Onenet Internet of things platform - mqtts product equipment connected to the platform
- Interpretation of R & D effectiveness measurement framework
- Extended tree (I) - concept and C implementation
- Typora adds watermarks to automatically uploaded pictures
- Joint Time-Frequency and Time Domain Learning for Speech Enhancement
- Virtualenv+pipenv virtual environment management
- 【20211129】Jupyter Notebook远程服务器配置
猜你喜欢

Prepare for the Blue Bridge Cup Day10__ PWM control light brightness

【单片机】【数码管】数码管显示

S7-1500PLC仿真
![[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 8](/img/16/e1a0a52964c8a55eb729469114fc60.jpg)
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 8

uniapp 使用 uni-upgrade-center
![[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4](/img/4f/bc6c39ef4f2d1c4bdad8420f7badac.jpg)
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4

Seckill system 03 - redis cache and distributed lock

91.(cesium篇)cesium火箭發射模擬

easyexcel的使用

One year anniversary of bitbear live studio, hero rally order! I invite you to take a group photo!
随机推荐
Onenet Internet of things platform - mqtt product devices send messages to message queues MQ
Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS
[classic example] classic list questions @ list
邻接矩阵无向图(一) - 基本概念与C语言
Golang根据参数引入相应配置文件的实现方式
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 7
Value/sortedset in redis
Personnaliser le plug - in GRPC
Computer graduation project asp Net attendance management system vs developing SQLSERVER database web structure c programming computer web page source code project
Golang introduces the implementation method of the corresponding configuration file according to the parameters
Value/hush in redis
自定義 grpc 插件
MQ prevent message loss and repeated consumption
C summary of knowledge points 1
Joint Time-Frequency and Time Domain Learning for Speech Enhancement
Deep understanding of grpc part1
【20211129】Jupyter Notebook远程服务器配置
C summary of knowledge points 3
Prepare for the Blue Bridge Cup Day10__ PWM control light brightness
Comment Nike a - t - il dominé la première place toute l'année? Voici les derniers résultats financiers.