用VHDL语言设计电梯控制器

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

石家庄经济学院数字逻辑课程设计报告题目电梯控制器的设计姓名menghao学号班号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个状态机之间转换的代码;指示灯进程为内外部请求指示灯的代码。libraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_unsigned.all;entitysandiantiisport(anclk:instd_logic;--按键时钟信号ticlk:instd_logic;--电梯时钟信号reset:instd_logic;--复位fiup:instd_logic;--1楼外部上升请求seup:instd_logic;--2楼外部上升请求sedn:instd_logic;--2楼外部下降请求thdn:instd_logic;--3楼外部下降请求uplight:bufferstd_logic_vector(3downto1);---上升请求指示灯dnlight:bufferstd_logic_vector(3downto1);---下降请求指示灯yilou,erlou,sanlou:instd_logic;----停站请求splight:bufferstd_logic_vector(3downto1);--停站请求指示灯weizhi:bufferintegerrange1to3;---位置指示door:outstd_logic;---门状态指示updown:bufferstd_logic);--上升下降状态指示endsandianti;architecturemenghaoofsandiantiistypelift_stateis----状态机(lift1,dooropen,doorclose,wait1,wait2,wait3,wait4,up,down,stop);signalmeng:lift_state;signalclearup:std_logic;----清除上升状态signalcleardn:std_logic;----清除下降状态beginctrlift:process(reset,ticlk)------电梯控制进程variablehao:integerrange3downto1;----显示楼层同weizh作用一样,但显示方便beginifreset='1'thenmeng=lift1;clearup='0';cleardn='0';elseifticlk'eventandticlk='1'thencasemengiswhenlift1=door='1';weizhi=1;hao:=1;meng=wait1;whenwait1=meng=wait2;whenwait2=clearup='0';cleardn='0';meng=wait3;whenwait3=meng=wait4;whenwait4=meng=doorclose;whendoorclose=door='0';ifupdown='0'thenifweizhi=3thenifsplight=000anduplight=000anddnlight=000thenupdown='1';meng=doorclose;elseupdown='1';meng=down;endif;elsifweizhi=2thenifsplight=000anduplight=000anddnlight=000thenupdown='0';meng=doorclose;elsifsplight(3)='1'or(splight(3)='0'anddnlight(3)='1')thenupdown='0';meng=up;elseupdown='1';meng=down;endif;elsifweizhi=1thenifsplight=000anduplight=000anddnlight=000thenupdown='0';meng=doorclose;elseupdown='0';meng=up;endif;endif;elsifupdown='1'thenifweizhi=1thenifsplight=000anduplight=000anddnlight=000thenupdown='0';meng=doorclose;elseupdown='0';meng=up;endif;elsifweizhi=2thenifsplight=000anduplight=000anddnlight=000thenupdown='1';meng=doorclose;elsifsplight(1)='1'or(splight(1)='0'anduplight(1)='1')thenupdown='1';meng=down;elseupdown='0';meng=up;endif;elsifweizhi=3thenifsplight=000anduplight=000anddnlight=000thenupdown='1';meng=doorclose;elseupdown='1';meng=down;endif;endif;endif;whenup=weizhi=weizhi+1;hao:=hao+1;ifhao3and(splight(hao)='1'oruplight(hao)='1')thenmeng=stop;elsifhao=3and(splight(hao)='1'ordnlight(hao)='1')thenmeng=stop;elsemeng=doorclose;endif;whendown=weizhi=weizhi-1;hao:=hao-1;ifhao1and(splight(hao)='1'ordnlight(hao)='1')thenmeng=stop;elsifhao=1and(splight(hao)='1'oruplight(hao)='1')thenmeng=stop;elsemeng=doorclose;endif;whenstop=meng=dooropen;whendooropen=door='1';ifupdown='0'thenifweizhi=2and(splight(weizhi)='1'oruplight(weizhi)='1')thenclearup='1';elseclearup='1';cleardn='1';endif;elsifupdown='1'thenifweizhi=2and(splight(weizhi)='1'ordnlight(weizhi)='1')thencleardn='1';elseclearup='1';cleardn='1';endif;endif;meng=wait1;endcase;endif;endif;endprocessctrlift;ctrlight:process(reset,anclk)-----指示灯进程beginifreset='1'thensplight=000;uplight=000;dnlight=000;elseifanclk'eventandanclk='1'thenifclearup='1'thensplight(weizhi)='0';uplight(weizhi)='0';elseiffiup='1'thenuplight(1)='1';elsifseup='1'thenuplight(2)='1';endif;endif;ifcleardn='1'thensplight(weizhi)='0';dnlight(weizhi)='0';elseifsedn='1'thendnlight(2)='1';elsifthdn='1'thendnlight(3)='1';endif;endif;ifyilou='1'thensplight(1)='1';elsiferlou='1'th

1 / 12
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功