用VHDL语言设计电梯控制器
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
石家庄经济学院数字逻辑课程设计报告
题目电梯控制器的设计
姓名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.1
5.设计方案
实验要求设计一个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 is
type lift_state is ----状态机
(lift1,dooropen,doorclose,wait1,wait2,wait3,wait4,up,down,stop); signal meng:lift_state;
signal clearup:std_logic; ----清除上升状态