汽车尾灯vhdl设计
汽车尾灯vhdl设计
标签/分类:
1.系统设计要求
用6个发光管模拟6个汽车尾灯(左右各3个),用4个开关作为汽车控制信号,分别为:左拐、右拐、故障和刹车。
车匀速行驶时,6个汽车尾灯全灭;右拐时,车右边3个尾灯从左至右顺序亮灭;左拐时,车左边3个尾灯从右至左顺序亮灭;故障时车6个尾灯一起明灭闪烁;刹车时,6个尾灯全亮
2.系统设计方案
根据系统设计要求,采用自顶向下设计方法,顶层设计采用原理图设计,它由主控模块、左边灯控制模块和右边灯控制模块三部分组成。
3参考vhdl源程序
(1) 主控制模块
说明:此程序为系统主控制模块。当左转时,lft信号有效;右转时,rit信号有效;当左右信号都有效的时,lr有效。
libraryieee;
useieee.std_logic_1164.all;
entitykzis
port(left,right:instd_logic;
lft,rit,lr:outstd_logic);
endkz;
architecturekz_arcofkzis
begin
process(left,right)
variablea:std_logic_vector(1downto0);
begin
a:=left&right;
caseais
when00=>lft<='0';
rit<='0';
lrlft<='1';
rit<='0';
lrrit<='1';
lft<='0';
lrrit<='1';
lft<='1';
lr<='1';
endcase;
endprocess;
endkz_arc;
(2)左边灯控制模块
说明:此模块的功能是当左转时控制左边的3个灯,当左右信号都有效时,输出为全“1”。
libraryieee;
useieee.std_logic_1164.all;
entitylftais
port(en,clk,lr:instd_logic;
l2,l1,l0:outstd_logic);
endlfta;
architecturelft_arcoflftais
begin
process(clk,en,lr)
variabletmp:std_logic_vector(2downto0);
begin
iflr='1'then
tmp:=111;
elsifen='0'then
tmp:=000;
elsifclk'eventandclk='1'then
iftmp=000then
tmp:=001;
else
tmp:=tmp(1downto0)&'0';
endif;
endif;
l2<=tmp(2);
l1<=tmp(1);
l0<=tmp(0);
endprocess;
endlft_arc;
(2) 右边灯控制模块
说明:此模块的功能是控制右边的3个灯,与上面模块相似。
libraryieee;
useieee.std_logic_1164.all;
entityritais
port(en,clk,lr:instd_logic;
r2,r1,r0:outstd_logic);
endrita;
architecturerit_arcofritais
begin
process(clk,en,lr)
variabletmp:std_logic_vector(2downto0);
begin
iflr='1'then
tmp:=111;
elsifen='0'then
tmp:=000;
elsifclk'eventandclk='1'then
iftmp=000then
tmp:=100;
else
tmp:='0'&tmp(2downto1);
endif;
endif;
r2<=tmp(2);
r1<=tmp(1);
r0<=tmp(0);
endprocess;
endrit_arc;
KK模组、同步带模组和线性模组的区别在哪里?
中科曙光液冷技术助力绿色城轨
MIT利用机器学习技术 将MRI比对程序缩短至2分钟
如何在由大数据驱动的人工智能时代立足?
玩家的春日好礼!三星星翼QX2系列重构游戏电视
汽车尾灯VHDL设计
电路板维修:开关电源易损3个元件(MOSFET管、检流电阻、驱动电阻)
专为48V电动汽车应用而开发的eFuse参考设计
LED如何调光及调光的正确方法
机智玩家放下手机,竟然还能玩手机?
电源线滤波器性能的优劣取决于什么因素?
蓄电池修复-电池过充电修复
沉浸式墙面互动展厅解决方案
化学机械抛光是一种广泛应用的高精度全局平面化技术
美国无线充电距离突破50英尺 军方青睐
STR S6708开关电源控制电路引脚功能及电压
物联网正在彻底改变交通行业的运作方式
智慧路灯杆方案的改造升级,加速智慧社区的建设
如何在Rust中高效地操作文件
无刷驱动控制方案定制开发