Delay
void Delay(unsigned int z)
{
int x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
Key(独立键盘)
#include <REGX52.H>
#include "Delay.h"
unsigned char Key()
{
unsigned char KeyNum=0;
if(P3_4==0){
Delay(20);while(P3_4==0);Delay(20);KeyNum=1;}
if(P3_5==0){
Delay(20);while(P3_5==0);Delay(20);KeyNum=2;}
if(P3_6==0){
Delay(20);while(P3_6==0);Delay(20);KeyNum=3;}
if(P3_7==0){
Delay(20);while(P3_7==0);Delay(20);KeyNum=4;}
return KeyNum;
}
//char 型为八位能够更好的移植
MatrixKey(矩阵键盘)(无脑法)
#include <REGX52.H>
#include "Delay.h"
unsigned char MatrixKey

这篇博客详细介绍了STC89C52单片机的各种函数模块,包括Delay延迟函数、独立键盘Key操作、矩阵键盘MatrixKey的无脑法实现、Nixie数码管显示以及Timer0定时器的使用。文中还结合中断号图进行了深入讲解。
&spm=1001.2101.3001.5002&articleId=104138658&d=1&t=3&u=7420daacb97242359839e0e2cd24332c)
676

被折叠的 条评论
为什么被折叠?



