当前位置:网站首页>STM32F1与STM32CubeIDE编程实例-矩阵键盘驱动
STM32F1与STM32CubeIDE编程实例-矩阵键盘驱动
2022-06-28 12:50:00 【视觉智能】
矩阵键盘驱动
1、矩阵键盘介绍
键盘是广泛用于各种电子和嵌入式项目的输入设备。 它们用于以数字和字母的形式获取输入,并将其输入系统以进行进一步处理。
矩阵键盘由一组相互连接的按钮组成。 在本次实例中使用 4X4 矩阵键盘,其中四行中的每一行都有 4 个按钮。 按钮端子按下图所示示连接。 在第一行,所有4个按钮的一个端子连接在一起,4个按钮的另一个端子代表4列中的每一列,每行也是如此。 所以一共有 8 根线来连接一个微控制器。

首先,需要配置 8 个 GPIO 引脚。 其中四个是输入,另外四个是输出引脚。 然后您可以将列引脚连接到输入或输出引脚,但为方便起见,我将它们连接到 4 个输出引脚。
最后但同样重要的是,4 行引脚将连接到微控制器的 4 个输入引脚。 如下图所示:

如何确定键盘中哪个按键按下?
1)查找列位置
- 首先,将所有行都设置为逻辑级别 0,将所有列设置为逻辑级别 1。
- 每当按下一个按键时,对应于该按钮的列和行就会短路,并使相应的列变为逻辑电平 0。因为该列连接(短路)到处于逻辑电平 0 的行。
边栏推荐
- 从SimpleKV到Redis
- JS duration and asynchronous function promise
- Microservice stability guarantee
- $100000 AI competition: the task of finding "worse" big models
- 基础软件照搬开源不可取,自力更生才是正途
- Hundreds of lines of code to implement a JSON parser
- How to install SSL certificates in Microsoft Exchange 2010
- JS class 并不只是简单的语法糖!
- 从 jsonpath 和 xpath 到 SPL
- Xiaobai's e-commerce business is very important to choose the right mall system!
猜你喜欢

Flink流处理API大合集:掌握所有flink流处理技术,看这一篇就够了

最新!基于Open3D的点云处理入门与实战教程

Fastposter v2.8.4 release e-commerce poster generator
![[cloud native] can self-service reports and Bi do so many things?](/img/80/2b797eb5875dc2b4c2876f2cb3d6f7.png)
[cloud native] can self-service reports and Bi do so many things?
JS class is not just a simple syntax sugar!

Enterprise source code confidentiality scheme sharing

Tips for using ugui (V) using scroll rect component

##测试bug常用“Redmine”
![[MySQL from introduction to mastery] [advanced part] (III) creation of MySQL users_ Modification_ Delete and password settings](/img/9c/2a0eb8f5ec03aebbe231dbdb388eca.png)
[MySQL from introduction to mastery] [advanced part] (III) creation of MySQL users_ Modification_ Delete and password settings

为什么CAD导出PDF没有颜色
随机推荐
[unity Editor Extension practice] dynamically generate UI code using TXT template
Performance test-01-introduction
Jerry's wif interferes with Bluetooth [chapter]
杰理之SPI1外挂FLASH录音修改【篇】
基于SSM实现水果蔬菜商城管理系统
Unity Editor Extension Foundation, editorguilayout (II)
思源官方付费同步使用指南
async-validator. JS data verifier
IPETRONIK数据采集设备携手Softing Q-Vision软件致力于ADAS测试方案
Mathematical principle derivation of structured light phase shift method + multifrequency heterodyne
JS class 并不只是简单的语法糖!
Wi-Fi 7 来啦,它到底有多强?
flink核心之watermarker
【历史上的今天】6 月 28 日:马斯克诞生;微软推出 Office 365;蔡氏电路的发明者出生
Validateur async. Vérificateur de données JS
Xiaobai's e-commerce business is very important to choose the right mall system!
分页样式 flex设置成在尾部显示(即使页数加长 也不会因为在末尾而换行)
. Net hybrid development solution 24 webview2's superior advantages over cefsharp
K3s one click installation script
Ugui force refresh of layout components