新聞中心

        EEPW首頁 > 汽車電子 > 設計應用 > 汽車尾燈VHDL設計

        汽車尾燈VHDL設計

        作者: 時間:2011-05-01 來源:網絡 收藏

        設計

        標簽/分類:

        本文引用地址:http://www.104case.com/article/197462.htm

        1.系統(tǒng)設計要求
        用6個發(fā)光管模擬6個(左右各3個),用4個開關作為汽車控制信號,分別為:左拐、右拐、故障和剎車。
        車勻速行駛時,6個全滅;右拐時,車右邊3個尾燈從左至右順序亮滅;左拐時,車左邊3個尾燈從右至左順序亮滅;故障時車6個尾燈一起明滅閃爍;剎車時,6個尾燈全亮
        2.系統(tǒng)設計方案
        根據系統(tǒng)設計要求,采用自頂向下設計方法,頂層設計采用原理圖設計,它由主控模塊、左邊燈控制模塊和右邊燈控制模塊三部分組成。
        3參考源程序
        (1) 主控制模塊
        說明:此程序為系統(tǒng)主控制模塊。當左轉時,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:=leftright;
        caseais
        when00=>lft='0';
        rit='0';
        lr='0';
        when10=>lft='1';
        rit='0';
        lr='0';
        when01=>rit='1';
        lft='0';
        lr='0';
        whenothers=>rit='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;


        關鍵詞: VHDL 汽車尾燈

        評論


        相關推薦

        技術專區(qū)

        關閉
        主站蜘蛛池模板: 龙井市| 新宁县| 奉新县| 雷山县| 呼伦贝尔市| 忻城县| 湖口县| 洪湖市| 五大连池市| 阜新市| 通江县| 南漳县| 武汉市| 东乡族自治县| 安图县| 瓦房店市| 安仁县| 德阳市| 福泉市| 阆中市| 洛南县| 简阳市| 宜州市| 吉安市| 万源市| 武陟县| 广昌县| 孝义市| 桃园市| 汝城县| 庄河市| 玛多县| 靖西县| 兰坪| 伊川县| 永宁县| 宜城市| 达州市| 北票市| 穆棱市| 资阳市|