ImageVerifierCode 换一换
格式:DOCX , 页数:15 ,大小:39.71KB ,
资源ID:21531803      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/21531803.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(基于VHDL的四层电梯控制器Word格式.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

基于VHDL的四层电梯控制器Word格式.docx

1、四层电梯控制器的设计主要是对实体和结构体的设计,它的VHDL描述模块流程如图3.1所示:图3.1 四层电梯控制器的VHDL描述模块流程VHDL源代码说明:library IEEE; -库的说明use IEEE.std_logic_1164.all; -程序包的说明use IEEE.std_logic_unsigned.all;use IEEE.std_logic_arith.all; -(arith)entity fourlift is -实体名称fourlift port(clk1:in std_logic; -按键读取时钟信号 clk2: -led_7数码管显示扫描时钟信号 reset:

2、-异步复位端口 close: -关门请求 f1upbutton: -一层上升请求端口 f2upbutton: -二层上升请求端口 f2dnbutton: -二层下降请求端口 f3dnbutton: -三层下降请求端口 f3upbutton: -三层上升请求端口 f4dnbutton: -四层下降请求端口 stop1button: -一层停站请求端口 stop2button: -二层停站请求端口 stop3button: -三层停站请求端口 stop4button: -四层停站请求端口 stair:buffer integer range 1 to 4; -电梯位置信号 udsig:buffer

3、 std_logic; -电梯运行模式(上升1或下降0 fuplight,fdnlight,stoplight:buffer std_logic_vector(4 downto 1);-上升、下降、停站请求寄存信号 doorlight:out std_logic; -开门状态 (1为开门状态) dout:out std_logic_vector(6 downto 0); - 数码管显示楼层段码 s:out std_logic_vector(2 downto 0); -数码管显示楼层位码end entity fourlift;architecture chi of fourlift is -结构

4、体type lift_state is -定义十个状态(stop_on_1,door_open,door_close,door_wait1,door_wait2,door_wait3,door_wait4,up,down,stop);signal state:lift_state;signal clr_up:std_logic; -上升和停站请求清除信号signal clr_dn: -下降和停站请求清除信号signal q:std_logic_vector(3 downto 0); -分频进程中需要的信号signal buttonclk,liftclk: -分频后的电梯时钟和按键读取控制时钟b

5、eginclklift:process(clk1) -分频产生电梯控制时钟liftclk和按键读取控制时钟buttonclk begin if (clk1event and clk1=1) then if q=1111 then q=0000; else q=q+1; end if; end if; buttonclk=q(0); liftclk=q(3); end process clklift;statelift:process(reset,liftclk) -状态机进程variable position:integer range 4 downto 1;if reset= then -异

6、步复位,电梯的初始状态为一层开门状态 state=stop_on_1; clr_up=0 clr_dn doorlight -开门 stair if(close=) then state=door_close;-如果有关门信号,则转至关门状态 else state if(close=door_wait3;等待第三秒 when door_wait3= if(close= else state when door_close= -关门,判定电梯下一个运行方式 if udsig= then -电梯处在上升模式 if stair=4 then if fuplight= and fdnlight= an

7、d stoplight= then -没有请求信号时,电梯停 在当前层 udsig -电梯处于上升状态=stair+1; -电梯楼层数加一=position+1; if position -电梯处在下降状态=stair-1; -电梯楼层数减一=position-1; if position1 and (stoplight(position)= and fdnlight(position)= elsif position=1 and (stoplight(position)= when stop= when door_open= if stair1 and (fdnlight(position)

8、= -清除当前层下降和停站请求 end case;end if;end process statelift;ctrlight:process(reset,buttonclk) -信号灯控制进程 then -复位,寄存信号清零 fuplight fdnlight stoplight if buttonclkevent and buttonclk= if f1upbutton= then -记忆各层上升请求 fuplight(1) if f2upbutton= fuplight(2) if f3upbutton= fuplight(3) if clr_up= then -上升和停站请求清零 fup

9、light(stair) stoplight(stair) if f2dnbutton= then -记忆各层下降请求 fdnlight(2) if f3dnbutton= fdnlight(3) if f4dnbutton= fdnlight(4) if clr_dn= then -下降和停站请求清零 fdnlight(stair) if stop1button= then -记忆各层停站请求 stoplight(1) if stop2button= stoplight(2) if stop3button= stoplight(3) if stop4button= stoplight(4)e

10、nd process ctrlight;showlift:process(stair,clk2) -楼层显示进程s000if stair=1 then dout0110000elsif stair=2 then1101101elsif stair=3 then1111001elsif stair=4 then0110011end process showlift;end architecture chi;四层电梯控制器的仿真:在波形仿真中,根据实际,我们有必要做一些假设,即是:外部请求上升的乘客,进入电梯后一定是按更高层的停站按钮;外部请求下降的乘客,进入电梯后一定是按更低层的停站按钮;如果有

11、乘客进入电梯,则一定有停站请求;同一时刻有很多人按键的概率很小,所以我们认为请求信号都有一定的先后顺序。设定仿真时间长度为60s,liftclk信号为周期1s的时钟信号,buttonclk信号为周期0.1s的时钟信号。doorlight信号逻辑1表示开门,逻辑0表示关门。udsig信号为逻辑1表示电梯处在上升模式,逻辑0表示处在下降模式。fuplight,fdnlight,stoplight是四位二进制向量,波形图中的0001表示一层有请求,0010表示二层有请求,0100表示三层有请求,1000表示四层有请求。图1所示的波形是在一层有上升请求的仿真波形,在reset信号产生一个脉冲时,电梯回复初始状态,即stopon_1状态,然后等待4s,关门检测没有请求信号,于是电梯此时停在一层。当电梯时钟上升沿检测到一层上升请求信号fuplight(1)为1时,电梯开门,fuplight(1)清零,等待4s,关门检测到二层停站请求,于是电梯上升到二层停止,开门stoplight(2)清零,stair信号由001变为010,电梯最终停在二层。 图1 有上升请求的仿真波形 图2所示的波形是三层有下降请求的

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1