用VHDL语言设计电梯控制器_第1页
用VHDL语言设计电梯控制器_第2页
用VHDL语言设计电梯控制器_第3页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、石家庄经济学院数字逻辑课程设计报告题 目电梯控制器的设计姓 名 meng hao学 号班 号 3 班指导老师 成 绩2011年6月1. 课程设计目的2. 设计任务3. 开发工具选择 3. 设计方案4. 模块描述5. VHDL 实现6. 调试仿真7. 课程设计回顾总结参 考 文 献 1. 课程设计目的1) 使学生更好地巩固和加深对基础知识的理解,学会设计中小型数字系统的方法,独立完成调试过程,增强学生理论联系实际的能力,提高学生电路设计和分析的能力。2) 通过实践教学引导学生在理论指导下有所创新,为后继专业课的学习和日后工程实践奠定基础。2、设计要求1) 综合应用课程中学到的理论知识,独立完成一

2、个设计任务。2) 根据所要完成的设计任务,采用硬件描述语言VHDL进行描述,依靠计算机,借助 EDA开发工具,实现系统功能。3) 整理设计报告及相关的文档(包括总体设计思想,设计说明,程序源代码,仿真结果图、设计总结等)。3 .设计任务任务和要求:可使用拨键开关输入欲到达的楼层。要求有数码管显示当前楼层,目标楼层,并且可以输入三个目标楼层,按输入的顺序达到,达到时有开门指示灯。在电梯移动时,有相应的指示灯显示其方向。注意:电梯经过一个楼层和在楼层停留应各自设定一个固定时间。4开发工具选择quarters n 5.15. 设计方案实验要求设计一个 3层的电梯的梯控制器,采用状态机来实现,这样思路

3、清晰,便于理解。可以分为10个状态,为“一楼”、“等待状态1 ”、“等待状态2”、“等待状态3”、“等待状态4”、“开门”、“关门”、“上升”、“下降”、“停止”。各状态之间按需要转换。由状态机进程和信号指示灯进程一起控制。输入由电梯外部的请求,电梯内部的请求,时钟信号组成。输岀由指示灯和电梯位置组成。6. 模块描述分为4各部分人员输入模块为按键模块电梯控制模块为电梯条件判断状态模块信号灯指示模块为指示灯显示模块电梯终端模块为电梯服务模块7. VHDL实现代码分为实体,结构体两大块;结构体中又分为电梯进程和指示灯进程; 电梯进程为 10 个状态机之间转换的代码; 指示灯进程为内外部请求指示灯的

4、代码。library ieee;entity sandianti isport(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_logi

5、c_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,doo

6、ropen,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 作用一样,但显示方便beginif reset='1' thenmeng<=lift1;clearup<

7、='0'cleardn<='0'elseif ticlk'event and ticlk='1' thencase meng iswhen lift1=>door<='1'weizhi<=1;hao:=1; meng<=wait1;when wait1=>meng<=wait2;when wait2=>clearup<='0'cleardn<='0' meng<=wait3;when wait3=>meng<=wa

8、it4;when wait4=>meng<=doorclose;when doorclose=>door<='0'if updown='0' thenif weizhi=3 thenif splight="000" and uplight="000" and dnlight="000" then updown<='1'meng<=doorclose;else updown<='1'meng<=down;end if;elsi

9、f 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')thenupdown<='0' meng<=up;else updown<='1'meng<

10、;=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' thenif weizhi=1 thenif splight="000" and uplight=&

11、quot;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

12、)='1' or (splight(1)='0' and uplight(1)='1')thenupdown<='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<=doorcl

13、ose;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') then meng<=stop;elsif hao=3 and (splight(hao)='1' or dnlight (hao)='1') then meng<=stop;else meng

14、<=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<

15、=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(wei

16、zhi)='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' then splight<="000"uplight&l

17、t;="000"dnlight<="000"elseif anclk'event and anclk='1' thenif clearup='1' then splight(weizhi)<='0'uplight(weizhi)<='0'elseif fiup='1' then uplight(1)<='1'elsif seup='1' then uplight(2)<='1' end if

18、;end if;if cleardn='1' then splight(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' the

19、n splight(2)<='1'elsif sanlou='1' then splight(3)<='1'end if;end if;end if;end process ctrlight;end architecture men ghao;8.调试仿真1.电梯在2楼外部有上升请求,电梯从 1楼升到2楼,开门,在电梯内部有3楼停站,电梯到达3楼,之后内外没有请求,电梯停在3楼。tu11.7n oytl&uB 0erkooft 03 &zJ-C"UIB 0f LIPB s&tin0 05 b"

20、;ipB 1thinB IkP low9 0io *rE 0田 sflightB oorID djListab oai田 jli gLtR OH田 rikchiB 014A:LIab atilha i¥山jk11. 7 aLrnr1 1<tenJnna< .QUOk険壯QWXf©QLIL13 T ns:30 n us10 p ris410. ns30 9 nsrLrLrL_n_rLn_rLn_rLn_rLn_rLrLn_rLn_n_n_j2.电梯在3楼外部有下降请求,电梯从 1楼升到3楼,开门,在电梯内部有 1楼停站,电梯到达1楼,之后内外没有请求,电梯停在1楼

21、。Mtxttr Timt Bax'11.T nxStirt;N:amareset y i lou srlou zanlouL fiup stdnthdnvp dxiwn.door三Jgh电±J olLj eht El i± eizhi 初rlk ti H女Valie :11 7 i9 08 D:j3 Da dB oB DB 1B DB DB 00(B IMB CM£ 01B DB 1L1.1F H5 JI1-I厂11J(odoJ£ocixDOI( 皿 X1003CJOc1 HI0UL)X11Hw X120- ¥ jis40- Q ns60, Q ns80k Q ;* |Poinl4r:62.83 zisItirvil:juuuinrLrLnnjuuuuumnrmjuumnrLrLnmuumrLnnrLrLruuu3 电梯在2楼外部有上升请求,电梯从 1楼升到2楼,开门,在电梯内部有 3楼停站,电

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论