欢迎来到天天文库
浏览记录
ID:12917715
大小:50.00 KB
页数:3页
时间:2018-07-19
《基于protues矩阵键盘c程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include#definekeypP1#defineucharunsignedcharsbitp20=P2^0;sbitp21=P2^1;sbitp22=P2^2;sbitp23=P2^3;sbitp24=P2^4;sbitp25=P2^5;sbitp26=P2^6;sbitp27=P2^7;sbitp30=P3^0;sbitp31=P3^1;sbitp32=P3^2;sbitp33=P3^3;sbitp34=P3^4;sbitp35=P3^5;sbitp36=P3^6;sbitp37=P3^7;unsignedcharkeyv=0xff;ucharkeys(v
2、oid);voidkeyaa(void);voiddelay(intn){inti,j;for(i=0;i3、0;readk=xtemp4、ytemp;delay(10);keyp=0x0f;xtemp=keyp&0x0f;if(xtemp==0x0f)return(0xff);keyp=0xf0;ytemp=keyp&0xf0;rereadk=xtemp5、ytemp;if(readk==rereadk){return(~rereadk);}return(0xff);}voidkeyaa(void){switch(keyv){case0x11:p20=0;delay(50);p20=1;break;case0x21:p21=0;break;case0x41:p22=0;break;case0x6、81:p23=0;break;//第一行、、case0x12:p24=0;break;case0x22:p25=0;break;case0x42:p26=0;break;case0x82:p27=0;break;//第二行、、case0x14:p30=0;break;case0x24:p31=0;break;case0x44:p32=0;break;case0x84:p33=0;break;//第三行、、case0x18:p34=0;break;case0x28:p35=0;break;case0x48:p36=0;break;case0x88:p37=0;break;//第四行、、7、default:break;}}
3、0;readk=xtemp
4、ytemp;delay(10);keyp=0x0f;xtemp=keyp&0x0f;if(xtemp==0x0f)return(0xff);keyp=0xf0;ytemp=keyp&0xf0;rereadk=xtemp
5、ytemp;if(readk==rereadk){return(~rereadk);}return(0xff);}voidkeyaa(void){switch(keyv){case0x11:p20=0;delay(50);p20=1;break;case0x21:p21=0;break;case0x41:p22=0;break;case0x
6、81:p23=0;break;//第一行、、case0x12:p24=0;break;case0x22:p25=0;break;case0x42:p26=0;break;case0x82:p27=0;break;//第二行、、case0x14:p30=0;break;case0x24:p31=0;break;case0x44:p32=0;break;case0x84:p33=0;break;//第三行、、case0x18:p34=0;break;case0x28:p35=0;break;case0x48:p36=0;break;case0x88:p37=0;break;//第四行、、
7、default:break;}}
此文档下载收益归作者所有