- 23
- 0
- 约4.83千字
- 约 4页
- 2017-06-08 发布于重庆
- 举报
三层电梯控制vhdl语言
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity threelift12345 is--实体 port buttonclk:in std_logic; --按键时钟信号 liftclk:in std_logic; --电梯时钟信号 reset:in std_logic; --异步复位端口 f1upbutton:in std_logic; --一层上升请求端口 f2upbutton:in std_logic; --二层上升请求端口 f2dnbutton:in std_logic; --二层下降请求端口 f3dnbutton:in std_logic; --三层下降请求端口 stop1button:in std_logic; --一层停站请求端口 stop2button:in std_logic; --二层停站请求端口 stop3button:in std_logic; --三层停站请求端口 position:buffer integer range 1 to 3; --电梯位置信号 udsig:buffer std_logic; --电梯模式(上升或下降)信号
fuplight,fdnlight,stoplight:buffer std_logic_vector 3 downto 1 ;--上升、下降、停站请求寄存信号 doorlight:out std_logic; --开关门信号 dout1:out std_logic_vector 2 downto 0 ; end entity;
architecture art of threelift12345 is --结构体
type lift_state is ---定义十个状态
stopon1,dooropen,doorclose,doorwait1,doorwait2,doorwait3,doorwait4,up,down,stop ;
signal mylift:lift_state;
signal clearup:std_logic; --上升和停站请求清除信号
signal cleardn:std_logic;---下降和停站请求清除信号
begin
process reset,liftclk is--状态机进程
variable pos:integer range 3 downto 1; begin if reset 1 then ----异步复位,电梯的初始状态为一层开门状态 mylift stopon1;clearup 0;cleardn 0; else if liftclkevent and liftclk 1 then mylift doorwait1; case mylift is when stopon1 doorlight 1;position 1; pos: 1; mylift doorwait1;--电梯等待4s when doorwait1 mylift doorwait2; when doorwait2 clearup 0;cleardn 0;mylift doorwait3; when doorwait3 mylift doorwait4; when doorwait4 mylift doorclose; when doorclose ---关门,判定电梯下一个运行方式 doorlight 0; if udsig 1 then--电梯处在上升模式 if position 3 then if fuplight 000 and fdnlight 000 and stoplight 000 then--没有请求信号时,电梯停在当前层 udsig 0;mylift doorclose; elsif fdnlight 3 1 or stoplight 3 1 then --本层有请求信号是,电梯开门 udsig 0;mylift dooropen; else --否则下降 udsig 0;mylift down; end if; elsif position 2 then if fuplight 000 and fdnlight 000 and stoplight 000 then udsig 1;mylift doorclose; elsif fuplight 2 1 or stoplight 2 1 then--本层有上升或停站请求
您可能关注的文档
最近下载
- 图案变化与统一课件设计.pptx VIP
- 2025年金融风险管理师买入看跌期权与卖出看跌期权策略专题试卷及解析.pdf VIP
- 2025年拍卖师拍卖谈判中的谈判记录与总结技巧专题试卷及解析.pdf VIP
- 2025年房地产经纪人客户隐私保护监管政策解读专题试卷及解析.pdf VIP
- 基于单片机的数控直流稳压电源的设计.docx VIP
- 县域消费扶贫与长效帮扶机制分析.pdf VIP
- 2025年项目管理专业项目交付成果验收检查表编制专题试卷及解析.pdf VIP
- 煤矿露天改扩建项目竣工验收报告.docx
- 人体解剖学复习测试有答案(二).doc VIP
- 基于stm32的智能小车设计毕业设计论文.docx VIP
原创力文档

文档评论(0)