VHDL汽车尾灯设计_第1页
VHDL汽车尾灯设计_第2页
VHDL汽车尾灯设计_第3页
VHDL汽车尾灯设计_第4页
VHDL汽车尾灯设计_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

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

文档简介

一、 实验目的掌握VHDL程序设计方法二、 实验内容和要求共6个尾灯,汽车正常行驶时,6个灯全灭;左转时,左边3个灯从右到左依次亮灭;右转时,右边3上灯从左到右依次亮灭;刹车时,车灯全亮;故障时,全部闪烁。在软件工具平台上,进行VHDL语言的各个模块编程输入、编译实现和仿真验证。三、 实验仪器计算机四、 实验方法、步骤及结构测试1.系统设计与方案:根据系统设计要求,采用自顶向下设计方法,顶层设计采用原理图设计,它由主控模块、左边灯控制模块和右边灯控制模块三部分组成。2.系统功能:用6个发光管模拟6个汽车尾灯(左右各3个),用4个开关作为汽车控制信号,分别为:左拐、右拐、故障和刹车。4个输入信号为:3参考VHDL源程序(1) 主控制模块说明:此程序为系统主控制模块。当左转时,lft信号有效;右转时,rit信号有效;当左右信号都有效的时,lr有效。libraryieee; ritlft=0;-正常rit=0;lrlft=1;-左转lrrit=1;-右转lft=0;lrrit=1;-STOPlft=1;lr=1;endcase;endprocess;endkz_arc;当左右信号都有效时,输出为全“”(2)左边灯控制模块说明:此模块的功能是当左转时控制左边的3个灯,library ieee;use ieee.std_logic_1164.all;entity lfta is port(en,clk,left:in std_logic; l_out:out std_logic_vector( 2 downto 0);end lfta;architecture lft_arc of lfta isbegin process(clk,en,left) variable tmp:std_logic_vector(2 downto 0); begin if clkevent and clk=1 then if en=1 then-故障使能端,高电平有效 if tmp=000 then tmp:=111; else tmp:=000; end if;-en=1,故障,左边三个灯一起闪烁 elsif left=0 then tmp:=000; -当left=0,左边三个灯全灭 else if tmp=000 then tmp:=001; else tmp:=tmp(1 downto 0)&0;-当left有效时,左边三个灯依次闪烁 end if; end if; end if; l_out=tmp; end process;end lft_arc;仿真图当en为“”即故障时,三个灯同时闪烁.且优先级最高;当left,en无效时输出为“”即三个灯全灭。当en无效left有效时,三个灯依次闪烁。(2) 右边灯控制模块说明:此模块的功能是控制右边的3个灯,与上面模块相似。library ieee;use ieee.std_logic_1164.all;entity rita is port(en,clk,right:in std_logic; r_out:out std_logic_vector(2 downto 0);end rita;architecture rit_arc of rita is begin process(clk,en,right) variable tmp:std_logic_vector(2 downto 0); begin if clkevent and clk=1 then if en=1 then-故障使能端,高电平 if tmp=000 then tmp:=111; else tmp:=000; end if;-故障时,三个一起闪烁。 elsif right=0 then tmp:=000; else if tmp=000 then tmp:=100; else tmp:=0&tmp(2 downto 1);-当righte 有效时,右边三个灯依次闪烁 end if; end if; end if;r_outlft=0; rit=0; lrlft=1; rit=0; lrrit=1; lft=0; lrrit=1; lft=1; lr=1; end case; end process;-主模块process(clk,en,lr,lft,rit)- 左边灯控制模块 variable tmp:std_logic_vector(2 downto 0); begin if lr=1 then tmp:=111;-左、右都有效时,实现刹车功能 elsif clkevent and clk=1 then if en=1 then if tmp=000 then tmp:=111; else tmp:=000; end if;-故障时,同时闪烁elsif lft=0 and rit=0 then tmp:=000; elsif lft=1then if tmp=000 then tmp:=001; else tmp:=tmp(1 downto 0)&0;-依次闪烁 end if; end if;end if; l_out=tmp; end process;- 左边灯控制模块 process(clk,en,lr,rit)- 右边灯控制模块 variable tmp:std_logic_vector(2 downto 0); begin if lr=1 then tmp:=111;-左、右都有效时,实现刹车功能 elsif clkevent and clk=1 then if en=1 then if tmp=000 then tmp:=111; else tmp:=000; end if; -故障时,同时闪烁 elsif lft=0 and rit=0 then tmp:=000; elsif rit=1then if tmp=000 then tmp:=100; else tmp:=0&tmp(2 downto 1); 依次闪烁 end if; end if; end if; r_out=tmp; end process;- 右边灯控制模块end kz_arc;从仿真图看出,基本功能都实现:当en1时,发生故障,六个全部同时闪烁。l_out和r_out在clk条件下来,输出全部时则输出为,否输出为。当en为时:当左、右信号都无效,则六个灯全灭。即当left和right都为时,输出全为。当左、右信号都有效时,则六个灯全亮。即left和right都为时,输出全为。当左信号有效时且右信号无效时,则车左转,左边三个灯从右到左依次亮灭。即当left=1且right=0时,则l_out从l_out(0)l_out(2)依次输出一个脉冲周期的高电平。当左信号无效时且右信号有效时,则右转,右转时,右边3上灯从左到右依次亮灭。即当left=且right=时,则r_out从r_out(0)l_out(2)依次输出一个脉冲周期的高电平。五结论与体会当刚接触MAX-puls II这软件时,由自己的英语水平有限,基本功能,操作不会。对于VHDL很陌生,几个钟的实验时间都白白浪费。经过老师的指导,请教同学。基本弄懂MAX-puls II操作流程。VHDL语言刚开始很生疏,做汽车尾灯设计时,不能画出其基本组成框图。一时毫无头绪,经过上网,去图书馆找资料,还有就是经过几个星期课程设计(课程设计都有VHDL的应用

温馨提示

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

评论

0/150

提交评论