4×4键盘仿真、程序及pcb

上传者: lance15 | 上传时间: 2023-04-04 03:08:28 | 文件大小: 84KB | 文件类型: RAR
#include #define uchar unsigned char #define uint unsigned int uchar buff,times,j; unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f, //0,1,2,3 0x66,0x6d,0x7d,0x07, //4,5,6,7 0x7f,0x6f,0x77,0x7c, //8,9,A,B 0x39,0x5e,0x79,0x71,0x00}; //C,D,E,F,null unsigned char idata value[8]; void delay1ms(void) //消抖动 { uchar i; for(i=200;i>0;i--); } void delay5ms(void) //延时5ms { unsigned char i,j; for(i=5;i>0;i--) for(j=248;j>0;j--); } void key_scan(void) //键盘输入扫描函数 { uchar hang,lie,key; P3=0xf0; if((P3&0xf0)!=0xf0) //行码为0,列码为1 { delay1ms(); if((P3&0xf0)!=0xf0) //有键按下,列码变为0 { hang=0xfe; //逐行扫描 times++; if(times==2) times=1; while((hang&0x10)!=0) //扫描完4行后跳出 { P3=hang; if((P3&0xf0)!=0xf0) //本行有键按下 { lie=(P3&0xf0)|0x0f; buff=((~hang)+(~lie)); switch(buff) { case 0x11: key=0;break; case 0x21: key=1;break; case 0x41: key=2;break; case 0x81: key=3;break; case 0x12: key=4;break; case 0x22: key=5;break; case 0x42: key=6;break; case 0x82: key=7;break; case 0x14: key=8;break; case 0x24: key=9;break; case 0x44: key=10;break; case 0x84: key=11;break; case 0x18: key=12;break; case 0x28: key=13;break; case 0x48: key=14;break; case 0x88: key=15;break; } value[times-1]=key; //按下的键值 } else hang=(hang<<1)|0x01; //下一行扫描 } } } } void main(void) { uchar key; while(1) { key_scan(); P0=0; for(j=times;j>0;j--) { P2=j-1; //数码管列扫描 P0=dispcode[value[times-j]]; //A-G数据 delay5ms(); } } }

文件下载

资源详情

[{"title":"( 18 个子文件 84KB ) 4×4键盘仿真、程序及pcb","children":[{"title":"51单片机4X4键盘仿真程序和pcb","children":[{"title":"key.c <span style='color:#111;'> 2.11KB </span>","children":null,"spread":false},{"title":"key_scan_Opt.Bak <span style='color:#111;'> 1.24KB </span>","children":null,"spread":false},{"title":"KEY.PWI <span style='color:#111;'> 832B </span>","children":null,"spread":false},{"title":"key_scan.hex <span style='color:#111;'> 1.09KB </span>","children":null,"spread":false},{"title":"key_scan.Opt <span style='color:#111;'> 1.24KB </span>","children":null,"spread":false},{"title":"key.LST <span style='color:#111;'> 4.09KB </span>","children":null,"spread":false},{"title":"键盘.ddb <span style='color:#111;'> 342.00KB </span>","children":null,"spread":false},{"title":"Last Loaded KEY.DBK <span style='color:#111;'> 163.28KB </span>","children":null,"spread":false},{"title":"key_scan.plg <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"中国最专业的专注于大学生电子设计竞赛的论坛.url <span style='color:#111;'> 236B </span>","children":null,"spread":false},{"title":"key_scan_Uv2.Bak <span style='color:#111;'> 2.01KB </span>","children":null,"spread":false},{"title":"KEY.DSN <span style='color:#111;'> 163.28KB </span>","children":null,"spread":false},{"title":"key_scan.h <span style='color:#111;'> 698B </span>","children":null,"spread":false},{"title":"key_scan <span style='color:#111;'> 3.94KB </span>","children":null,"spread":false},{"title":"key_scan.lnp <span style='color:#111;'> 28B </span>","children":null,"spread":false},{"title":"key_scan.M51 <span style='color:#111;'> 7.66KB </span>","children":null,"spread":false},{"title":"key.OBJ <span style='color:#111;'> 4.75KB </span>","children":null,"spread":false},{"title":"key_scan.Uv2 <span style='color:#111;'> 1.61KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明