欢迎来到三一文库! | 帮助中心 三一文库31doc.com 一个上传文档投稿赚钱的网站
三一文库
全部分类
  • 研究报告>
  • 工作总结>
  • 合同范本>
  • 心得体会>
  • 工作报告>
  • 党团相关>
  • 幼儿/小学教育>
  • 高等教育>
  • 经济/贸易/财会>
  • 建筑/环境>
  • 金融/证券>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 三一文库 > 资源分类 > DOC文档下载  

    用VHDL语言设计电梯控制器.doc

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

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

    用VHDL语言设计电梯控制器.doc

    石家庄经济学院数字逻辑课程设计报告题 目 电梯控制器的设计 姓 名 meng hao 学 号 班 号 3 班 指导老师 成 绩 2011年6月目 录1. 课程设计目的2. 设计任务3. 开发工具选择3. 设计方案 4 模块描述5. VHDL实现6. 调试仿真7. 课程设计回顾总结 参 考 文 献 1. 课程设计目的1) 使学生更好地巩固和加深对基础知识的理解,学会设计中小型数字系统的方法,独立完成调试过程,增强学生理论联系实际的能力,提高学生电路设计和分析的能力。2) 通过实践教学引导学生在理论指导下有所创新,为后继专业课的学习和日后工程实践奠定基础。2、设计要求1) 综合应用课程中学到的理论知识,独立完成一个设计任务。2) 根据所要完成的设计任务,采用硬件描述语言VHDL进行描述,依靠计算机,借助EDA开发工具,实现系统功能。3) 整理设计报告及相关的文档(包括总体设计思想,设计说明,程序源代码,仿真结果图、设计总结等)。3 . 设计任务任务和要求:可使用拨键开关输入欲到达的楼层。要求有数码管显示当前楼层,目标楼层,并且可以输入三个目标楼层,按输入的顺序达到,达到时有开门指示灯。在电梯移动时,有相应的指示灯显示其方向。注意:电梯经过一个楼层和在楼层停留应各自设定一个固定时间。4开发工具选择quarters 5.15.设计方案实验要求设计一个3层的电梯的梯控制器,采用状态机来实现,这样思路清晰,便于理解。可以分为10个状态,为“一楼”、“等待状态1”、 “等待状态2”、“等待状态3”、 “等待状态4”、 “开门”、“关门”、“上升”、“下降”、“停止”。各状态之间按需要转换。由状态机进程和信号指示灯进程一起控制。输入由电梯外部的请求,电梯内部的请求,时钟信号组成。输出由指示灯和电梯位置组成。6.模块描述分为4各部分人员输入模块电梯控制模块电梯终端模块信号灯指示模块人员输入模块为按键模块电梯控制模块为电梯条件判断状态模块信号灯指示模块为指示灯显示模块电梯终端模块为电梯服务模块7. VHDL实现代码分为实体,结构体两大块;结构体中又分为电梯进程和指示灯进程;电梯进程为10个状态机之间转换的代码;指示灯进程为内外部请求指示灯的代码。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity sandianti is port(anclk:in std_logic;-按键时钟信号 ticlk:in std_logic;-电梯时钟信号 reset:in std_logic;-复位 fiup:in std_logic;-1楼外部上升请求 seup:in std_logic;-2楼外部上升请求 sedn:in std_logic;-2楼外部下降请求 thdn:in std_logic;-3楼外部下降请求 uplight:buffer std_logic_vector(3 downto 1);-上升请求指示灯 dnlight:buffer std_logic_vector(3 downto 1);-下降请求指示灯 yilou,erlou,sanlou:in std_logic;-停站请求 splight:buffer std_logic_vector(3 downto 1);-停站请求指示灯 weizhi:buffer integer range 1 to 3;-位置指示 door:out std_logic; -门状态指示 updown:buffer std_logic);-上升下降状态指示end sandianti;architecture menghao of sandianti istype lift_state is -状态机(lift1,dooropen,doorclose,wait1,wait2,wait3,wait4,up,down,stop);signal meng:lift_state;signal clearup:std_logic; -清除上升状态signal cleardn:std_logic; -清除下降状态beginctrlift:process(reset,ticlk)-电梯控制进程variable hao:integer range 3 downto 1;-显示楼层 同weizh作用一样,但显示方便 begin if reset=1 thenmeng<=lift1;clearup<=0;cleardn<=0; else if ticlkevent and ticlk=1 thencase meng is when lift1=>door<=1;weizhi<=1;hao:=1;meng<=wait1; when wait1=>meng<=wait2; when wait2=>clearup<=0;cleardn<=0;meng<=wait3; when wait3=>meng<=wait4; when wait4=>meng<=doorclose; when doorclose=>door<=0;if updown=0 then if weizhi=3 thenif splight="000" and uplight="000" and dnlight="000" thenupdown<=1; meng<=doorclose;else updown<=1;meng<=down;end if; elsif weizhi=2 thenif splight="000" and uplight="000" and dnlight="000" then updown<=0; meng<=doorclose;elsif splight(3)=1 or (splight(3)=0 and dnlight(3)=1) then updown<=0; meng<=up;else updown<=1;meng<=down;end if; elsif weizhi=1 thenif splight="000" and uplight="000" and dnlight="000" then updown<=0; meng<=doorclose;else updown<=0;meng<=up;end if; end if;elsif updown=1 then if weizhi=1 thenif splight="000" and uplight="000" and dnlight="000" then updown<=0; meng<=doorclose;else updown<=0; meng<=up;end if; elsif weizhi=2 thenif splight="000" and uplight="000" and dnlight="000" then updown<=1; meng<=doorclose;elsif splight(1)=1 or (splight(1)=0 and uplight(1)=1) then updown<=1; meng<=down;else updown<=0;meng<=up;end if; elsif weizhi=3 thenif splight="000" and uplight="000" and dnlight="000" then updown<=1; meng<=doorclose;else updown<=1;meng<=down;end if; end if;end if;when up=>weizhi<=weizhi+1;hao:=hao+1;if hao<3 and (splight(hao)=1 or uplight(hao)=1) thenmeng<=stop;elsif hao=3 and (splight(hao)=1 or dnlight (hao)=1) thenmeng<=stop;else meng<=doorclose;end if;when down=>weizhi<=weizhi-1;hao:=hao-1;if hao>1 and (splight(hao)=1 or dnlight(hao)=1)then meng<=stop;elsif hao=1 and (splight(hao)=1 or uplight(hao)=1)then meng<=stop;else meng<=doorclose;end if;when stop=>meng<=dooropen;when dooropen=>door<=1;if updown=0 thenif weizhi<=2 and (splight(weizhi)=1 or uplight(weizhi)=1) thenclearup<=1;else clearup<=1; cleardn<=1;end if;elsif updown=1 thenif weizhi>=2 and (splight(weizhi)=1 or dnlight(weizhi)=1) thencleardn<=1;else clearup<=1;cleardn<=1;end if;end if;meng<=wait1;end case;end if;end if;end process ctrlift;ctrlight:process(reset,anclk) -指示灯进程beginif reset=1 thensplight<="000"uplight<="000"dnlight<="000"elseif anclkevent and anclk=1 thenif clearup=1 thensplight(weizhi)<=0;uplight(weizhi)<=0;elseif fiup=1 then uplight(1)<=1;elsif seup=1 then uplight(2)<=1;end if;end if;if cleardn=1 thensplight(weizhi)<=0;dnlight(weizhi)<=0;elseif sedn=1 then dnlight(2)<=1;elsif thdn=1 then dnlight(3)<=1;end if;end if;if yilou=1 then splight(1)<=1;elsif erlou=1 then splight(2)<=1;elsif sanlou=1 then splight(3)<=1;end if;end if; end if;end process ctrlight;end architecture menghao;8. 调试仿真1.电梯在2楼外部有上升请求,电梯从1楼升到2楼,开门,在电梯内部有3楼停站,电梯到达3楼,之后内外没有请求,电梯停在3楼。2. 电梯在3楼外部有下降请求,电梯从1楼升到3楼,开门,在电梯内部有1楼停站,电梯到达1楼,之后内外没有请求,电梯停在1楼。3电梯在2楼外部有上升请求,电梯从1楼升到2楼,开门,在电梯内部有3楼停站,电梯到达3楼,开门,之后电梯在2楼外部有下降请求,电梯从3楼下到2楼,开门,在电梯内部有1楼停站,电梯到达1楼,开门,之后内外没有请求,电梯停在1楼。4.电梯在1楼外部有上升请求,进入电梯,内部有3楼停站请求,在电梯上升过程中,在2楼外部有下降请求,不理会,电梯到达3楼,之后相应2楼外部下降请求,在2楼停止开门,之后内部有1楼停站请求,下降到1楼,之后内外没有请求,电梯停在1楼。9. 课程设计回顾总结在编程的过程中,由于考虑的情况不够全面,也出现了不少问题,例如代码出错了,所以当仿真的时候仿真波形和实际不符,经过改正之后可以了实现了。由于第一次写这种比较复杂的,情况这么多的代码,开始的初期有很大的障碍,之后经过查阅相关资料,还是实现了设计要求的功能,这个代码,功能还是有些不太全,有些缺陷,并不能和实际情况完全一样,还有很多的情况没有考虑进去,但是时间有限,只能这样了。通过这次的课程设计,把理论和实际结合了起来,让我更加理解了VHDL语言在日常生活中的应用。参 考 文 献数字逻辑与数字系统 -张兴忠等编著

    注意事项

    本文(用VHDL语言设计电梯控制器.doc)为本站会员(罗晋)主动上传,三一文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一文库(点击联系客服),我们立即给予删除!

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




    经营许可证编号:宁ICP备18001539号-1

    三一文库
    收起
    展开