《单片机原理与应用》课件(18)

上传人:woxinch****an2018 文档编号:35831007 上传时间:2018-03-21 格式:PPT 页数:8 大小:388KB
返回 下载 相关 举报
《单片机原理与应用》课件(18)_第1页
第1页 / 共8页
《单片机原理与应用》课件(18)_第2页
第2页 / 共8页
《单片机原理与应用》课件(18)_第3页
第3页 / 共8页
《单片机原理与应用》课件(18)_第4页
第4页 / 共8页
《单片机原理与应用》课件(18)_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《《单片机原理与应用》课件(18)》由会员分享,可在线阅读,更多相关《《单片机原理与应用》课件(18)(8页珍藏版)》请在金锄头文库上搜索。

1、任务二 行列式键盘输入实验,任务要求:P1口接44键盘作为输入,P2口输出。按下0号键数码管显示0,按下1号键数码管按下时显示1,以此类推。,项目五 单片机键盘接口技术,#includereg51.h#includeabsacc.h#define uchar unsigned char#define uint unsigned intunsigned char code num =0x3f, 0x06,0x5b,0x46,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00;void delays(void);ucha

2、r kbscan(void);,void main( ) uchar key,temp; while(1) key=kbscan(); switch(key) case 0x11: temp=0;break; case 0x21: temp=1;break; case 0x41: temp=2;break; case 0x81: temp=3;break; case 0x12: temp=4;break; case 0x22: temp=5;break; case 0x42: temp=6;break;,case 0x82: temp=7;break;case 0x14: temp=8;bre

3、akcase 0x24: temp=9;break;case 0x44: temp=10;break;case 0x84: temp=11;break;case 0x18: temp=12;break;case 0x28: temp=13;break;case 0x48: temp=14;break;case 0x88: temp=15;break;,default: temp=16; P2=numtemp;delays( ); ,void delays(void) uchar i; for(i=300;i0;i-); ,uchar kbscan(void) uchar scancode,recode; P1=0xf0; if(P1,return(scancode)+(recode);else scancode=(scancode1)|0x01; return(0);,

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 高中教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号