当前位置:网站首页>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 .
边栏推荐
- Why does the JVM heap memory exceed 32g and pointer compression fail?
- 指定的服务已标记为删除
- 91.(cesium篇)cesium火箭发射模拟
- 自定義 grpc 插件
- Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 7
- [classic example] classic list questions @ list
- Harbor webhook from principle to construction
- Unity xlua co process packaging
- 区间乘积的因子数之和——前缀和思想+定一移二
猜你喜欢

【datawhale202206】pyTorch推荐系统:召回模型 DSSM&YoutubeDNN

CPU 上下文切换的机制和类型 (CPU Context Switch)

Computer graduation project asp Net hotel room management system VS development SQLSERVER database web structure c programming computer web page source code project

Build yocto system offline for i.mx8mmini development board

消息队列之监控退款任务批处理过程

About keil compiler, "file has been changed outside the editor, reload?" Solutions for

Technology sharing | MySQL: how about copying half a transaction from the database?

Theoretical basis of graph

技术分享 | MySQL:从库复制半个事务会怎么样?

One year anniversary of bitbear live studio, hero rally order! I invite you to take a group photo!
随机推荐
S7-1500plc simulation
Deep understanding of grpc part1
用实际例子详细探究OpenCV的轮廓检测函数findContours(),彻底搞清每个参数、每种模式的真正作用与含义
指纹浏览器工作原理、使用场景以及重要性简单讲解
Machine learning - Data Science Library Day 3 - Notes
Learning summary on June 28, 2022
Neo4j Chinese developer monthly - issue 202206
The Missing Semester
Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
想问问,证券开户有优惠吗手机开户是安全么?
Prepare for the Blue Bridge Cup Day10__ PWM control light brightness
深入理解 grpc part1
Extended tree (I) - concept and C implementation
耐克如何常年霸榜第一名?最新財報答案來了
区间乘积的因子数之和——前缀和思想+定一移二
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4
LeetCode 454. 四数相加 II
About keil compiler, "file has been changed outside the editor, reload?" Solutions for
Value/string in redis
Redis的攻击手法