下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、23.模拟计算器数字输入及显示1.实验任务 1. 开机时,显示 0”2. 第一次按下时,显示 D1”;第二次按下时,显示 D1D2;第三按 下时,显示 D1D2D3, 8 个全显示完毕,再按下按键下时,给出 嘀”提示音。2.电路原理图图 4.23.13.系统板上硬件连线1. 把 单片机系统”区域中的 P1.0 端口用导线连接到 音频放大模块 区域中的 SPK IN 端口上;L:1-1 1*-Mr H 尸,* *0BSB* * 老 P*5曲口書层s wg 百rE EEILE1-r.rrmis wMWT 童rrc-HS-二zwnJIT.2.把单片机系统 区域中的 P3.0 P3.7 端口用 8 芯
2、排线连接到 4X4 亍列式键盘”区域中的 C1 C4R R4 端口上;3.把单片机系统”区域中的 P0.0 P0.7 端口用 8 芯排线连接到 动态数码显示”区域中的 A H 端口上;4. 把 单片机系统:区域中的 P2.0 P2.7 端口用 8 芯排线连接到 动态 数码显示”区域中的 S1 S8 端口上;4. 相关程序设计内容1 . 亍列式键盘输入及按键功能设定;2. 动态数码显示;3. 数码显示方式处理;5. 汇编源程序略)6. C 语言源程序#i nclude unsigned char codedispcode=0 x3f,0 x06,0 x5b,0 x4f,0 x66,0 x6d,0
3、 x7d,0 x07,0 x7f,0 x6f,0 x77,0 x7c,0 x39,0 x5e,0 x79,0 x71,0 x 00。unsigned char codedispbitcode=0 xfe,0 xfd,0 xfb,0 xf7,0 xef,0 xdf,0 xbf,0 x7f。unsigned char dispbuf8=0,16,16,16,16,16,16,16。unsigned char dispbitcount 。unsigned char temp 。unsigned char i,j 。unsigned char key 。unsigned char keypos 。bi
4、t alarmflag 。void change(unsigned char *p,unsigned char countP3=0 xff 。P3_4=0 。temp=P3 。temp=temp & 0 x0f 。if (temp!=0 x0ffor(i=50oi0。i-for(j=200。 j0 。 j-temp=P3otemp=temp & 0 x0fowhile(count0*(p+count=*(p+count-1 count-。void main(voidTMOD=0 x01。TH0=(65536-4000 / 256 。TL0=(65536-4000 % 256 。TR0=1 。E
5、T0=1 。EA=1 。while(1if (temp!=0 x0fchange(dispbuf,keyposdispbuf0=keytemp=P3 。temp=temp & 0 x0f 。 switch(tempcase 0 x0e:key=7。break。case 0 x0d:key=8。break。case 0 x0b:key=9。break。case 0 x07:key=10 。 break 。if (key=0 & (keykeypos+ 。if(keyposelsekeypos=8alarmflag=1P3=0 xff 。P3_5=0 。temp=P3 。temp=temp & 0
6、 x0f 。if (temp!=0 x0ffor(i=50oi0。i-for(j=200。 j0 。 j-temp=P3otemp=temp & 0 x0fotemp=P3 。 P1_0=P1_0 。 temp=temp & 0 x0f while(temp!=0 x0ftemp=P3 。temp=temp & 0 x0falarmflag=0 。if (temp!=0 x0fchange(dispbuf,keyposdispbuf0=keytemp=P3 。temp=temp & 0 x0f 。 switch(tempcase 0 x0e:key=4。break。case 0 x0d:key
7、=5。break。case 0 x0b:key=6。break。case 0 x07:key=11 。 break 。if (key=0 & (keykeypos+ 。if(keyposelsekeypos=8alarmflag=1P3=0 xff 。P3_6=0 。temp=P3 。temp=temp & 0 x0f 。if (temp!=0 x0ffor(i=50oi0。i-for(j=200。 j0 。 j-temp=P3otemp=temp & 0 x0fotemp=P3 。 P1_0=P1_0 。 temp=temp & 0 x0f while(temp!=0 x0ftemp=P3
8、。temp=temp & 0 x0falarmflag=0 。if (temp!=0 x0fchange(dispbuf,keyposdispbuf0=keytemp=P3 。temp=temp & 0 x0f 。 switch(tempcase 0 x0e:key=1。break。case 0 x0d:key=2。break。case 0 x0b:key=3。break。case 0 x07:key=12 。 break 。if (key=0 & (keykeypos+ 。if(keyposelsekeypos=8alarmflag=1P3=0 xff 。P3_7=0 。temp=P3 。t
9、emp=temp & 0 x0f 。if (temp!=0 x0ffor(i=50oi0。i-for(j=200。 j0 。 j-temp=P3otemp=temp & 0 x0fotemp=P3 。 P1_0=P1_0 。 temp=temp & 0 x0f while(temp!=0 x0ftemp=P3 。temp=temp & 0 x0falarmflag=0 。if (temp!=0 x0fchange(dispbuf,keyposdispbuf0=keytemp=P3 。 temp=temp & 0 x0f switch(tempcase 0 x0e: key=0 breakcase 0 x0d: key=13 breakcase 0 x0b: key=14 breakcase 0 x07:key=15 。 break 。if (key=0 & (keykeypos+ 。if(keyposkeypos=8alarmflag=1elsetemp=P3 。P1_0=P1_0 。 temp=temp & 0 x0f while(temp!=0 x0ftemp=P3 。temp=temp & 0 x0falarmflag=0 。void t0(void interrupt 1 using 0TH0=(65536-4000 / 256
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 现代营销学考试试题及答案
- 2026二年级数学上册 长度单位总结
- 2025年临床执业医师笔试模拟题
- 住宅质量保证书和住宅使用说明书制度
- 2026五年级数学上册 位置的知识梳理
- 企业的关于民族团结进步制度
- 企业专利预警制度
- 人事专题需不需要第一议题制度
- 猪场出栏奖惩制度方案及流程
- 男女朋友之间奖惩制度
- 第16项-爆破作业安全指导手册
- 时政播报活动方案
- DB11∕T 1200-2023 超长大体积混凝土结构跳仓法技术规程
- 小儿癫痫发作护理查房
- 中学食堂饭卡管理制度
- 春妆 春天清新妆容技巧与春风共舞
- 道路高程测量成果记录表-自动计算
- 搅拌站节水用水管理制度
- 基于大语言模型的语义理解研究-洞察阐释
- 陕西单招数学试题及答案
- 中外航海文化知到课后答案智慧树章节测试答案2025年春中国人民解放军海军大连舰艇学院
评论
0/150
提交评论