2022年ps键盘程 .pdf
《2022年ps键盘程 .pdf》由会员分享,可在线阅读,更多相关《2022年ps键盘程 .pdf(7页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、【原创】ps2 键盘程序/=/ps/2 键盘读程序/IOB2:时钟线 clock 黑/IOA0:数据线 data 红/by quankun 08-07-12/测试通过,输入的字符可以通过mingling数组查看。/支持数字键,字母键,回车,空格,f1-f5,f12,不支持组合键。有需要的同学可以参考下。/bit.h 为端口位操作,在这论坛上有,可以搜一下。/=#include SPCE061A.h#include bit.h unsigned int keydata=0 x0000;unsigned char mingling3030;int minglingi=0,minglingj=0;i
2、nt eoflag=0;int fflag=0;int startflag=0;int busy=0;int weishu=0;unsigned int datatemp=0;int data11;unsigned int suanwancheng=0;/用于指示主程序中是否算完了0,1。用于主程序与中断名师资料总结-精品资料欢迎下载-名师精心整理-第 1 页,共 7 页 -unsigned int zongwancheng=0;unsigned int zanting=0;unsigned int minglingjzhi30;int shifti=0;unsigned char makec
3、ode47=0 x1c,0 x32,0 x21,0 x23,0 x24,0 x2b,0 x34,0 x33,0 x43,0 x3b,0 x42,0 x4b,0 x3a,0 x31,0 x44,0 x4d,0 x15,0 x2d,0 x1b,0 x2c,0 x3c,0 x2a,0 x1d,0 x22,0 x35,0 x1a,0 x45,0 x16,0 x1e,0 x26,0 x25,0 x2e,0 x36,0 x3d,0 x3e,0 x46,0 x70,0 x69,0 x72,0 x7a,0 x6b,0 x73,0 x74,0 x6c,0 x75,0 x7d;unsigned char ascc
4、ode47=a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9;int m=0,n=0;int main()/设置 IOA0 为上拉式电阻输入P0_Dir=P0_Dir&0 xfffe;P0_Attrib=P0_Attrib&0 xfffe;P0_0=1;/设置 IOB2 口为上拉式电阻输入外部中断P1_Dir=P1_Dir&0 xfffb;P1_Attrib=P1_Attrib&0 xfffb;P1_2=1;*P_INT_Ctrl=*P_INT_Ctrl|C_I
5、RQ3_EXT1;_asm(INT IRQ);*P_SystemClock=0 x0070;名师资料总结-精品资料欢迎下载-名师精心整理-第 2 页,共 7 页 -while(1)*P_Watchdog_Clear=0 x0001;void IRQ3(void)_attribute_(ISR);void IRQ3(void)if(*P_INT_Ctrl&C_IRQ3_EXT1)_asm(IRQ OFF);/关闭 IRQ 中断。keydata=0;weishu=0;while(1)if(P1_2=0)dataweishu=P0_0;datatemp=P0_0;/马上取得数据if(weishu0)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年ps键盘程 2022 ps 键盘
限制150内