1 / 10

设计任务

楼梯照明灯控制器. 设计任务       设计一种楼梯照明灯控制器,当声音传感器探测到有人上楼或者下楼时,立即向照明灯控制器发出需要开等信号,控制器相应输出开灯信号,控制照明灯亮;若楼梯无人,则开灯信号无效,灯灭。假设有3层楼,每层安装一个声音传感器用以探测有无行人(本设计不包括声音传感器)。. 算法设计     用状态机结构设计楼梯照明等控制器。 VHDL 源程序 1. asm.vhd     2. 端口图     楼梯照明灯控制器端口图如图所示。. 3.楼梯照明灯控制器:. 源程序 library ieee;

Download Presentation

设计任务

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 楼梯照明灯控制器 • 设计任务 •       设计一种楼梯照明灯控制器,当声音传感器探测到有人上楼或者下楼时,立即向照明灯控制器发出需要开等信号,控制器相应输出开灯信号,控制照明灯亮;若楼梯无人,则开灯信号无效,灯灭。假设有3层楼,每层安装一个声音传感器用以探测有无行人(本设计不包括声音传感器)。

  2. 算法设计     用状态机结构设计楼梯照明等控制器。 VHDL源程序 1.asm.vhd     2.端口图     楼梯照明灯控制器端口图如图所示。

  3. 3.楼梯照明灯控制器:

  4. 源程序 library ieee;     use ieee.std_logic_1164.all;     entity asm is       port(call1,call2,call3:in std_logic;                              clr,clk:in std_logic;                kg1,kg2,kg3:out std_logic);     end; architecture a of asm is     type states is (s0,s1,s2);    --对状态机的状态进行声明。 signal q:std_logic_vector(0 to 2);      signal state:states;     begin     p1: process(clk,clr)

  5. begin       if(clr='0')then         state<=s0;       elsif(clk'event and clk='1')then              case state is    --用case语句描述状态机最方便。 when s0=>                  state<=s1;                when s1=>                  state<=s2;                when s2=> state<=s0;         end case;       end if;     end process p1;     p2:process(call1,call2,call3)

  6. begin       if cr='0' then          kg1<='0';                         kg2<='0';          kg3<='0';       else         case state is    when s0 =>           if call1='1'then              kg1<='1'; kg2<='0'; kg3<='0';     else            kg1<='0'; kg2<='0'; kg3<='0';       end if;          when s1=>            if call2='1'then                kg2<='1'; kg1<='0'; kg3<='0';        else

  7. kg2<='0'; kg1<='0'; kg3<='0';        end if;          when s2 =>            if call3='1'then                kg3<='1'; kg1<='0'; kg2<='0';        else                kg3<='0'; kg1<='0'; kg2<='0';         end if;       end case;     end if;     end process p2;     end;

  8. 源程序说明     1.程序所用时钟的频率应较高,以便 能快速扫描多个楼层。     2.本程序仿真波形图如图所示。由图 可见,设计要求已经实现。

  9. 仿真图形如下 : 1楼有人1楼灯亮

  10. 2楼有人2楼灯亮 2楼有人2楼灯亮 3楼有人3楼灯亮

More Related