欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOC文档下载  

    单片机硬件实习报告——模拟电梯设计.doc

    • 资源ID:2883364       资源大小:436.50KB        全文页数:12页
    • 资源格式: DOC        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    单片机硬件实习报告——模拟电梯设计.doc

    单片机硬件实习报告题 目 : 模 拟 电 梯 设 计 学生姓名: 学号: 学院(系: 专业班级: 指导教师: 实习时间: 2011 年 2 月 21 日 2010 年 3 月 4 日目 录1.前言11.1设计背景11.2设计内容11.3硬件实习的目的12.硬件电路描述及设计12.1 电路连线及概述12.2 8255扫描键盘及与LED接口电路图23.软件电路描述及设计33.1软件设计流程图34.源程序代码45.设计心得10参考文献101.前言1.1设计背景电梯作为现代高层建筑最常用的垂直运输工具,广泛应用于社会活动的各个角落,如何保证每台电梯都能够可靠运行,已成为提高物业管理水平和电梯技术进步的关键所在。电梯运行质量直接由控制系统的功能决定,而控制系统软件又直接决定着控制系统运行的好坏。上位机监控对电梯安全运行和故障维修具有重要意义,在减少维修管理人员的同时,可及时发现故障,缩短故障候梯时间,实现管理的自动化。面向对象的程序设计更适合对现实生活中的描述,更加体现了软件的工业化的精神。1.2设计内容本文根据实验室提供的单片机实验箱,利用键盘、开关、数码管和 LED模拟实现八层电梯的控制。并且设计急停开关和断电维修开关以模拟实物电梯的更多的运行功能。软件利用C语言,通过检测用户请求的按键信息,根据电梯运行到相应楼层送到单片机计数来确定楼层数,并送到数码管进行显示。硬件设计简单可靠,结合软件,基本实现了八层电梯运行的模拟。1.3硬件实习的目的(1)利用所学过的知识,初步分析单片机原理及接口技术的能力;(2)进一步掌握硬件电路和软件功能的设计方法;(3)了解8255可编程并行接口芯片的工作原理,掌握8255的各种模式编程方法;(4)实验结果调试分析、总结及撰写技术报告的能力。2.硬件电路设计及描述2.1 电路连线及概述P1.0-P1.7接L0-L7八个发光二极管2.2 8255扫描键盘与LED接口电路图3.软件设计流程及描述 3.1软件设计流程图4.源程序代码#include<reg52.h>#include<absacc.h>/*the address of 8255*/#define C8255 XBYTE0xF22B /8255command#define P8255A XBYTE0xF228#define P8255B XBYTE0xF229#define P8255C XBYTE0xF22A#define P8255 XBYTE0xF22A/* three tables */unsigned char code table= /Segment value for LED0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f;unsigned char code table1=/0x7f->Light P10 .0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe;unsigned char code table2= /P1=table1elevator.currentlevel|table2elevator.currentlevel0x80,0x40,0x20,0x10, /->Extinguish the led on current floor0x08,0x04,0x02,0x01;void init();void keyscan();void currentshow(unsigned char); void delay();/2svoid delayms();/20msunsigned int move;unsigned int currentfloor;unsigned int direction;unsigned int destination9;char times=0; unsigned int repairs; /0->do not repair; 1->repairing/* */ void main()unsigned char i,j;init(); /*init the elevator*/currentshow(currentfloor);while(1)while(repairs<=250) / repairs<=250 need to repairrepairs=P33;move=P31;keyscan();while(move=254&&destination0!=0) /moving key was pressed while(repairs<=250) / repairs<=250 need to repairrepairs=P33;keyscan(); /and at least 1 level wantedmove=P31;switch(direction)case 2: if(currentfloor=0) /declining move=0;direction=1;else for(j=currentfloor;j>0;j-) /weather there are destinations downstairsif(destinationj=0x1)break; if(j<=0) direction=1; else if(destinationcurrentfloor+1=1) move=0;destination0-;direction=0;destinationcurrentfloor=0;P1|=table2currentfloor;/Extinguish the corresponding ledcurrentfloor-;currentshow(currentfloor);/ "|"->bit orbreak;case 1: /risingif(currentfloor=8) /weather there are destinations upstairsmove=0;direction=2;else for(j=currentfloor+1;j<9;j+)if(destinationj=0x1)break;if(j>8)direction=2;elseif(destinationcurrentfloor+1!=0)/ move=0;destination0-;direction=0;destinationcurrentfloor+1=0;P1|=table2currentfloor;/Extinguish the corresponding led/ "|"->bit orcurrentshow(currentfloor);currentfloor+;break;default: /stationaryfor(i=1;i<9;i+) /decide up or downif(destinationi!=0)break; if(i<currentfloor)/should downdirection=2; else if(i>currentfloor)/should updirection=1;elsemove=0;destination0-;direction=0;destinationcurrentfloor=0;/the destination is current level, /do nothing but extiguish the ledP1|=table2currentfloor-1;delay(); /2s/levelvoid init() /timer,elevator unsigned char i;/*timer and external interrupt init*/TMOD=0x01;TH0=(65536-45872)/256;/50msTL0=(65536-45872)%256;EA=1;ET0=1;EX0=1;EX1=1;IT1=1;/*elevator init*/move=0;/*0->the elevator now will not move,commands comes from p30*/for(i=0;i<9;i+)destinationi=0; /no destinationdirection=0; /the elevator is stationary at the startcurrentfloor=0;/the elevator stops at first level at the start/*8255 init*/C8255=0x82; /PB in;PA,PC outrepairs=P33;void keyscan() /*save total number of destination to destination0*/ /*set destination1-9 if the correponding level wanted*/ unsigned char temp,key; P8255C=0x2; temp=P8255B; if(temp!=0xff) /key pressed delayms(); temp=P8255B;if(temp!=0xff) /confirmedtemp=P8255B;switch(temp)case 0xfe:key=0;P1&=table1key;break; /P1=table1key->light the corresponding ledcase 0xfd:key=1;P1&=table1key;break;case 0xfb:key=2;P1&=table1key;break;case 0xf7:key=3;P1&=table1key;break;case 0xef:key=4;P1&=table1key;break;case 0xdf:key=5;P1&=table1key;break;case 0xbf:key=6;P1&=table1key;break;case 0x7f:key=7;P1&=table1key;break;destinationkey+1=1; /set the corresponding level destination0+; /total number of destination temp=P8255B; while(temp!=0xff) temp=P8255B;void currentshow(unsigned char num)P8255C=0x0; /wei xuanP8255A=tablenum;void delayms()unsigned int i,j;/delay for 20msfor(i=20;i>0;i-)for(j=110;j>0;j-);void delay()TR0=1;while(times!=40)times=0;TR0=0;void T0_timer() interrupt 1TH0=(65536-45872)/256;/50msTL0=(65536-45872)%256;times+;void extern0() interrupt 0 /wait to repairEX1=0;if(repairs=0)repairs=1;elserepairs=0;EX1=1;void extern1() interrupt 3 /emergencydirection=0; /stop the elevatormove=0;5.设计心得本次实习我们选择了模拟日常生活中常见的电梯运行过程。这次实习让我对程序的设计、调试有了更深刻的认识。尤其是写单片机这类的与硬件相关的程序。在调试的时候会有不少意想不到的结果。这要求除了对程序充分了解,还要对硬件的特性,电路的连接也深刻认识。关于程序,总结如下:必须养成在写之前仔细分析需求、要求,画出流程图,先明确各个模块的作用。最后分块细化,从底向上设计的习惯。否则很容易出现程序写了一半发现理解出错,功能达不到的情况。还有程序注释必须及时,不能等到写完了再注释,否则可能之后连自己也看不懂程序。及时的修改记录也是必要的。对于硬件、电路:要熟练掌握如何用c、汇编语言操作芯片。要掌握常用芯片的用法、特性,至少要熟悉其datasheet,需要使用时通过查阅手册,能快速、熟练的使用该芯片。参考文献1.王玉芳 钟旭.微机原理与接口技术实验教程.广东高等教育出版社.2005年5月第2次印刷.2赵德安.单片机原理与应用M.北京:机械工业出版社,2008年5月3向艳,周天彤.C语言程序设计M.北京:清华大学出版社,2008年9月.4宁飞,王维华,孔宇.微型计算机原于是与接口实践M.北京:清华大学出版社,2006.5周炯如,潘操.EAT单片机应用开发系统实验指导书M.常州:常州大学信息科学与工程学院.2010年7月.

    注意事项

    本文(单片机硬件实习报告——模拟电梯设计.doc)为本站会员(laozhun)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开