好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

最容易理解矩阵键盘c程序.doc

4页
  • 卖家[上传人]:kms****20
  • 文档编号:40466136
  • 上传时间:2018-05-26
  • 文档格式:DOC
  • 文档大小:22KB
  • / 4 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • P3 口接矩阵键盘 #define uchar unsigned char uchar temp; void delay(uchar x) { uchar y,z; for(y=x;y>0;y--) for(z=125;z>0;z--) ; } uchar keyscan() { P3=0xfe; temp=P3; temp=temp while(temp!=0xf0) { delay(5); temp=P3; temp=temp while(temp!=0xf0) { temp=P3; switch(temp) { case 0xee:num=1; break; case 0xde:num=2; break; case 0xbe:num=3; break; case 0x7e:num=4; break; } while(temp!=0xf0) { temp=P3; temp=temp } } }P3=0xfd;temp=P3; temp=temp while(temp!=0xf0) { delay(5); temp=P3; temp=temp while(temp!=0xf0) { temp=P3; switch(temp) { case 0xed:num=5; break; case 0xdd:num=6; break; case 0xbd:num=7; break; case 0x7d:num=8; break; } while(temp!=0xf0) { temp=P3; temp=temp } } }P3=0xfb; temp=P3; temp=temp while(temp!=0xf0) { delay(5); temp=P3; temp=temp while(temp!=0xf0) { temp=P3; switch(temp) { case 0xeb:num=9;break; case 0xdb:num=10; break; case 0xbb:num=11; break; case 0x7b:num=12; break; } while(temp!=0xf0) { temp=P3; temp=temp } } }P3=0xf7; temp=P3; temp=temp while(temp!=0xf0) { delay(5); temp=P3; temp=temp while(temp!=0xf0) { temp=P3; switch(temp) { case 0xe7:num=13; break; case 0xd7:num=14; break; case 0xb7:num=15; break; case 0x77:num=16; break; } while(temp!=0xf0) { temp=P3; temp=temp }} } return num;}。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.