当前位置:网站首页>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 .
边栏推荐
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4
- 伸展树(一) - 概念和C实现
- Exposure: a white box photo post processing framework reading notes
- 241. 为运算表达式设计优先级 : DFS 运用题
- Onenet Internet of things platform - mqtt product devices send messages to message queues MQ
- Learning summary on June 29, 2022
- [MCU] [nixie tube] nixie tube display
- Onenet Internet of things platform - mqtt product equipment upload data points
- 力扣首页简介动画
- 区间乘积的因子数之和——前缀和思想+定一移二
猜你喜欢

自组织是管理者和成员的双向奔赴

Neo4j Chinese developer monthly - issue 202206

Theoretical basis of graph

Onenet Internet of things platform - mqtt product devices send messages to message queues MQ

Joint Time-Frequency and Time Domain Learning for Speech Enhancement

Deep understanding of grpc part1

MQ-防止消息丢失及重复消费

Redis' attack tactics
![[Yunju entrepreneurial foundation notes] Chapter VII Entrepreneurial Resource test 1](/img/be/1194125442aaa2d7cc20b6a4a6762a.jpg)
[Yunju entrepreneurial foundation notes] Chapter VII Entrepreneurial Resource test 1

如何看懂开发的查询语句
随机推荐
91.(cesium篇)cesium火箭发射模拟
Onenet Internet of things platform - create mqtts products and devices
邻接矩阵无向图(一) - 基本概念与C语言
对于mvvm和mvc的理解
Talk about biological live broadcast - genovis Zhang Hongyan antibody specific enzyme digestion technology helps to characterize the structure of antibody drugs
Golang des-cbc
[classic example] classic list questions @ list
ACLY与代谢性疾病
Redis common sense
Use of easyexcel
Interpretation of R & D effectiveness measurement framework
C summary of knowledge points 1
深入理解 grpc part1
使用set_handler过滤掉特定的SystemC Wraning &Error Message
力扣首页简介动画
Typora adds watermarks to automatically uploaded pictures
Machine learning - Data Science Library Day 3 - Notes
Mysql database knowledge collation
Comment Cao définit la décimale de dimension
USB peripheral driver - cable connect/disconnect