欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    交通灯信号控制设计--学士学位论文.doc

    • 资源ID:91637979       资源大小:4.52MB        全文页数:16页
    • 资源格式: DOC        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    交通灯信号控制设计--学士学位论文.doc

    EDA技术实验报告册班级: 姓名:学号:指导教师:开课时间: 2013 至 2014 学年第 1 学期实验名称交通灯信号控制设计实验时间2013年12月05日姓 名实验成绩一、实验目的1.掌握VHDL语言的基本结构。2.掌握VHDL层次化的设计方法。3.掌握VHDL基本逻辑电路的综合设计应用。二、实验设备计算机软件:Quartus IIEDA实验箱。主芯片:EPM7128SLC84-15或EP1K100QC208-3。下载电缆,导线等。三、实验内容设计并调试好一个由一条主干道和一条支干道的汇合点形成的十字交叉路口的交通灯控制器,具体要求如下:1.主、支干道各设一个绿、黄、红指示灯,两个显示数码管。2.主干道处于常允许通行状态,而支干道有车来时才允许通行。当主干道允许通行亮绿灯时,支干道亮红灯。而支干道允许通行亮绿灯时,主干道亮红灯。3.当主、支干道均有车时,两者交替允许通行,主干道每次放行45S,支干道每次放行25S,在每次由亮绿灯变成亮红灯的转换过程中,要亮5S的黄灯作为过渡,并进行减计时显示。要求编写交通灯控制器电路逻辑图中的各个模块的VHDL语言程序,并完成交通灯控制器的顶层设计,然后利用开发工具软件对其进行编译和仿真,最后要通过实验开发系统对其进行硬件验证。(一)编写交通灯控制器JTDKZ模块的VHDL程序,并对其进行编译和仿真,初步验证设计的正确性。LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY JTDKZ ISPORT(CLK, SM, SB: IN STD_LOGIC;MR, MY, MG, BR, BY, BG: OUT STD_LOGIC);END ENTITY JTDKZ;ARCHITECTURE ART OF JTDKZ ISTYPE STATE_TYPE IS(A, B, C, D);SIGNAL STATE: STATE_TYPE;signal cnt:integer range 0 to 45;BEGIN PROCESS(CLK) ISBEGINIF(CLK'EVENT AND CLK='1')THENCASE STATE IS WHEN A=> IF(SB AND SM)='1' THENIF CNT=44 THEN CNT<=0; STATE<=B;ELSE CNT<=CNT+1;STATE<=A; END IF; ELSIF(SB AND (NOT SM)='1' THENSTATE<=B; CNT<=0; ELSE STATE<=A; CNT<=0; END IF; WHEN B=> IF CNT=4 THEN CNT<=0;STATE<=C; ELSE CNT<=CNT+1;STATE<=B; END IF; WHEN C=> IF(SM AND SB)='1' THEN IF CNT=24 THEN CNT<=0; STATE<=D; ELSE CNT<=CNT+1;STATE<=C; END IF; ELSIF SB='0' THEN STATE<=D; CNT<=0; ELSE STATE<=C; CNT<=0; END IF;WHEN D=> IF CNT=4 THEN CNT<=0; STATE<=A; ELSE CNT<=CNT+1;STATE<=D; END IF;END CASE;END IF;END PROCESS ; RGY:PROCESS(STATE) ISBEGINCASE STATE ISWHEN A=>MR<='0' MY<='0' MG<='1'BR<='1' BY<='0' BG<='0'WHEN B=>MR<='0' MY<='1' MG<='0'BR<='1' BY<='0' BG<='0'WHEN C=>MR<='1' MY<='0' MG<='0'BR<='0' BY<='0' BG<='1'WHEN D=>MR<='1' MY<='0' MG<='0'BR<='0' BY<='1' BG<='0'END CASE; END PROCESS RGY;END ARCHITECTURE ART;(二)编写45S定时单元CNT45S模块的VHDL程序,并对其进行编译和仿真,初步验证设计的正确性。-45s定时模块源程序CNT45S.VHD LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY time_45s IS PORT(SB,SM, CLK, EN45: IN STD_LOGIC; DOUT45M, DOUT45B: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); END ENTITY time_45s ; ARCHITECTURE ART OF time_45s IS SIGNAL CNT6B: STD_LOGIC_VECTOR(5 DOWNTO 0); BEGIN PROCESS(SB, SM, CLK, EN45) IS BEGIN IF(CLK'EVENT AND CLK= '1')THEN IF SB='1' AND SM='1' THEN IF EN45='1'THEN CNT6B<=CNT6B+1;ELSE CNT6B<="000000" END IF; ELSE CNT6B<="000000" END IF; END IF; END PROCESS; PROCESS(CNT6B) IS BEGIN CASE CNT6B IS WHEN "000000"=>DOUT45M<="01000101" DOUT45B<="01010000" -BCD数45, 50 WHEN "000001"=>DOUT45M<="01000100" DOUT45B<="01001001" -BCD数44, 49 WHEN "000010"=>DOUT45M<="01000011" DOUT45B<="01001000" -BCD数43, 48 WHEN "000011"=>DOUT45M<="01000010" DOUT45B<="01000111" -BCD数42, 48 WHEN "000100"=>DOUT45M<="01000001" DOUT45B<="01000110" -BCD数41, 50 WHEN "000101"=>DOUT45M<="01000000" DOUT45B<="01000101" -BCD数40, 49 WHEN "000110"=>DOUT45M<="00111001" DOUT45B<="01000100" -BCD数39, 48 WHEN "000111"=>DOUT45M<="00111000" DOUT45B<="01000011" -BCD数38, 48 WHEN "001000"=>DOUT45M<="00110111" DOUT45B<="01000010" -BCD数37, 50 WHEN "001001"=>DOUT45M<="00110110" DOUT45B<="01000001" -BCD数36, 49 WHEN "001010"=>DOUT45M<="00110101" DOUT45B<="01000000" -BCD数35, 48 WHEN "001011"=>DOUT45M<="00110100" DOUT45B<="00111001" -BCD数34, 48 WHEN "001100"=>DOUT45M<="00110011" DOUT45B<="00111000" -BCD数33, 50 WHEN "001101"=>DOUT45M<="00110010" DOUT45B<="00110111" -BCD数32, 49 WHEN "001110"=>DOUT45M<="00110001" DOUT45B<="00110110" -BCD数31, 48 WHEN "001111"=>DOUT45M<="00110000" DOUT45B<="00110101" -BCD数30, 48 WHEN "010000"=>DOUT45M<="00101001" DOUT45B<="00110100" -BCD数29, 50 WHEN "010001"=>DOUT45M<="00101000" DOUT45B<="00110011" -BCD数28, 49 WHEN "010010"=>DOUT45M<="00100111" DOUT45B<="00110010" -BCD数27, 48 WHEN "010011"=>DOUT45M<="00100110" DOUT45B<="00110001" -BCD数26, 48 WHEN "010100"=>DOUT45M<="00100101" DOUT45B<="00110000" -BCD数25, 50 WHEN "010101"=>DOUT45M<="00100100" DOUT45B<="00101001" -BCD数24, 49 WHEN "010110"=>DOUT45M<="00100011" DOUT45B<="00101000" -BCD数23, 48 WHEN "010111"=>DOUT45M<="00100010" DOUT45B<="00100111" -BCD数22, 48 WHEN "011000"=>DOUT45M<="00100001" DOUT45B<="00100110" -BCD数21, 50 WHEN "011001"=>DOUT45M<="00100000" DOUT45B<="00100101" -BCD数20, 49 WHEN "011010"=>DOUT45M<="00011001" DOUT45B<="00100100" -BCD数19, 48 WHEN "011011"=>DOUT45M<="00011000" DOUT45B<="00100011" -BCD数18, 48 WHEN "011100"=>DOUT45M<="00010111" DOUT45B<="00100010" -BCD数17, 50 WHEN "011101"=>DOUT45M<="00010110" DOUT45B<="00100001" -BCD数16, 49 WHEN "011110"=>DOUT45M<="00010101" DOUT45B<="00100000" -BCD数15, 48 WHEN "011111"=>DOUT45M<="00010100" DOUT45B<="00011001" -BCD数14, 48 WHEN "100000"=>DOUT45M<="00010011" DOUT45B<="00011000" -BCD数13, 50 WHEN "100001"=>DOUT45M<="00010010" DOUT45B<="00010111" -BCD数12, 49 WHEN "100010"=>DOUT45M<="00010001" DOUT45B<="00010110" -BCD数11, 48 WHEN "100011"=>DOUT45M<="00010000" DOUT45B<="00010101" -BCD数10, 48 WHEN "100100"=>DOUT45M<="00001001" DOUT45B<="00010100" -BCD数9, 50 WHEN "100101"=>DOUT45M<="00001000" DOUT45B<="00010011" -BCD数8, 49 WHEN "100110"=>DOUT45M<="00000111" DOUT45B<="00010010" -BCD数7, 48 WHEN "100111"=>DOUT45M<="00000110" DOUT45B<="00010001" -BCD数6, 48 WHEN "101000"=>DOUT45M<="00000101" DOUT45B<="00010000" -BCD数5, 50 WHEN "101001"=>DOUT45M<="00000100" DOUT45B<="00001001" -BCD数4, 49 WHEN "101010"=>DOUT45M<="00000011" DOUT45B<="00001000" -BCD数3, 48 WHEN "101011"=>DOUT45M<="00000010" DOUT45B<="00000111" -BCD数2, 07 WHEN "101100"=>DOUT45M<="00000001" DOUT45B<="00000110" -BCD数1, 06 WHEN OTHERS=>DOUT45M<="00000000" DOUT45B<="00000000" -BCD数00, 00 END CASE; END PROCESS; END ARCHITECTURE ART;(三)编写25S定时单元CNT25S模块的VHDL程序,并对其进行编译和仿真,初步验证设计的正确性。-25s定时模块源程序CNT25S.VHD LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY time_25s IS PORT(SB, SM, CLK, EN25: IN STD_LOGIC; DOUT25M, DOUT25B: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); END ENTITY time_25s; ARCHITECTURE ART OF time_25s IS SIGNAL CNT_5Bit: STD_LOGIC_VECTOR(4 DOWNTO 0); BEGIN PROCESS(SB, SM, CLK, EN25) IS BEGIN IF SB='0' OR SM='0' THEN CNT_5Bit<="00000" ELSIF(CLK'EVENT AND CLK= '1')THEN IF EN25='1' THEN CNT_5Bit<=CNT_5Bit+1; ELSIF EN25='0'THEN CNT_5Bit<="00000" END IF; END IF; END PROCESS; PROCESS(CNT_5Bit) IS BEGIN CASE CNT_5Bit IS WHEN "00000"=>DOUT25B<="00100101" DOUT25M<="00110000" -BCD数25, 50 WHEN "00001"=>DOUT25B<="00100100" DOUT25M<="00101001" -BCD数24, 49 WHEN "00010"=>DOUT25B<="00100011" DOUT25M<="00101000" -BCD数23, 48 WHEN "00011"=>DOUT25B<="00100010" DOUT25M<="00100111" -BCD数22, 48 WHEN "00100"=>DOUT25B<="00100001" DOUT25M<="00100110" -BCD数21, 50 WHEN "00101"=>DOUT25B<="00100000" DOUT25M<="00100101" -BCD数20, 49 WHEN "00110"=>DOUT25B<="00011001" DOUT25M<="00100100" -BCD数19, 48 WHEN "00111"=>DOUT25B<="00011000" DOUT25M<="00100011" -BCD数18, 48 WHEN "01000"=>DOUT25B<="00010111" DOUT25M<="00100010" -BCD数17, 50 WHEN "01001"=>DOUT25B<="00010110" DOUT25M<="00100001" -BCD数16, 49 WHEN "01010"=>DOUT25B<="00010101" DOUT25M<="00100000" -BCD数15, 48 WHEN "01011"=>DOUT25B<="00010100" DOUT25M<="00011001" -BCD数14, 48 WHEN "01100"=>DOUT25B<="00010011" DOUT25M<="00011000" -BCD数13, 50 WHEN "01101"=>DOUT25B<="00010010" DOUT25M<="00010111" -BCD数12, 49 WHEN "01110"=>DOUT25B<="00010001" DOUT25M<="00010110" -BCD数11, 48 WHEN "01111"=>DOUT25B<="00010000" DOUT25M<="00010101" -BCD数10, 48 WHEN "10000"=>DOUT25B<="00001001" DOUT25M<="00010100" -BCD数9, 50 WHEN "10001"=>DOUT25B<="00001000" DOUT25M<="00010011" -BCD数8, 49 WHEN "10010"=>DOUT25B<="00000111" DOUT25M<="00010010" -BCD数7, 48 WHEN "10011"=>DOUT25B<="00000110" DOUT25M<="00010001" -BCD数6, 48 WHEN "10100"=>DOUT25B<="00000101" DOUT25M<="00010000" -BCD数5, 50 WHEN "10101"=>DOUT25B<="00000100" DOUT25M<="00001001" -BCD数4, 49 WHEN "10110"=>DOUT25B<="00000011" DOUT25M<="00001000" -BCD数3, 48WHEN "10111"=>DOUT25B<="00000010" DOUT25M<="00000111" -BCD数2, 07 WHEN "11000"=>DOUT25B<="00000001" DOUT25M<="00000110" -BCD数1, 06 WHEN OTHERS =>DOUT25B<="00000000" DOUT25M<="00000000" -BCD数00, 00 END CASE; END PROCESS; END ARCHITECTURE ART;(四)编写5S定时单元CNT05S模块的VHDL程序,并对其进行编译和仿真,初步验证设计的正确性。-5s定时模块源程序CNT05S.VHD LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY time_5s IS PORT(CLK, EN05M, EN05B: IN STD_LOGIC; DOUT5: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); END ENTITY time_5s; ARCHITECTURE ART OF time_5s IS SIGNAL CNT_3Bit: STD_LOGIC_VECTOR(2 DOWNTO 0); BEGIN PROCESS(CLK, EN05M, EN05B) IS BEGIN IF(CLK'EVENT AND CLK= '1')THEN IF EN05M='1' OR EN05B='1' THEN CNT_3Bit<=CNT_3Bit+1; ELSE CNT_3Bit<="000" END IF; END IF; END PROCESS; PROCESS(CNT_3Bit) IS BEGIN CASE CNT_3Bit IS WHEN "000" =>DOUT5<="00000101" -BCD数05 WHEN "001" =>DOUT5<="00000100" -BCD数04 WHEN "010" =>DOUT5<="00000011" -BCD数03 WHEN "011" =>DOUT5<="00000010" -BCD数02 WHEN "100" =>DOUT5<="00000001" -BCD数01 WHEN OTHERS=>DOUT5<="00000000" -BCD数00 END CASE; END PROCESS; END ARCHITECTURE ART;(五)编写显示控制单元XSKZ模块的VHDL程序,并对其进行编译和仿真,初步验证设计的正确性。-显示控制模块源程序XSKZ.VHD LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY XSKZ IS PORT(EN45, EN25, EN05M, EN05B:IN STD_LOGIC; AIN45M, AIN45B: IN STD_LOGIC_VECTOR(7 DOWNTO 0); AIN25M, AIN25B, AIN05: IN STD_LOGIC_VECTOR(7 DOWNTO 0); dec_m, dec_b: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); END ENTITY XSKZ; ARCHITECTURE ART OF XSKZ IS BEGIN PROCESS(EN45,EN25,EN05M, EN05B,AIN45M,AIN45B,AIN05,AIN25M,AIN25B) IS BEGIN IF EN45='1' THEN dec_m<=AIN45M(7 DOWNTO 0); dec_b<=AIN45B(7 DOWNTO 0); ELSIF EN05M='1' THEN dec_m<=AIN05(7 DOWNTO 0); dec_b<=AIN05(7 DOWNTO 0); ELSIF EN25='1' THEN dec_m<=AIN25M(7 DOWNTO 0); dec_b<=AIN25B(7 DOWNTO 0); -ELSIF EN05B='1' THEN ELSE dec_m<=AIN05(7 DOWNTO 0); dec_b<=AIN05(7 DOWNTO 0); END IF; END PROCESS; END ARCHITECTURE ART; (六)数码管动态扫描显示电路设计LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY disp_scan IS PORT(CLK_scan: IN STD_LOGIC; DEC_M: IN STD_LOGIC_VECTOR(7 DOWNTO 0); DEC_B: IN STD_LOGIC_VECTOR(7 DOWNTO 0); LEDW: OUT STD_LOGIC_VECTOR(2 DOWNTO 0); SEG7: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); END ENTITY disp_scan; ARCHITECTURE ART OF disp_scan ISsignal temp: STD_LOGIC_VECTOR(3 DOWNTO 0);signal CNT:STD_LOGIC_VECTOR(2 DOWNTO 0); begin PROCESS(CLK_scan) IS BEGIN IF CLK_scan'EVENT AND CLK_scan='1' THEN IF CNT="111" THEN CNT<="000" ELSE CNT<=CNT+'1' END IF; END IF; END PROCESS; LEDW<=CNT; PROCESS(CNT,TEMP,DEC_B,DEC_M) IS BEGIN CASE CNT IS WHEN "000" => TEMP<=DEC_M(7 DOWNTO 4); WHEN "001" => TEMP<=DEC_M(3 DOWNTO 0); WHEN "110" => TEMP<=DEC_B(7 DOWNTO 4); WHEN "111" => TEMP<=DEC_B(3 DOWNTO 0); WHEN OTHERS=> TEMP<="1111" END CASE; CASE TEMP IS WHEN "0000"=> SEG7<="00111111" WHEN "0001"=> SEG7<="00000110" WHEN "0010"=> SEG7<="01011011" WHEN "0011"=> SEG7<="01001111" WHEN "0100"=> SEG7<="01100110" WHEN "0101"=> SEG7<="01101101" WHEN "0110"=> SEG7<="01111101" WHEN "0111"=> SEG7<="00000111" WHEN "1000"=> SEG7<="01111111" WHEN "1001"=> SEG7<="01101111" WHEN OTHERS=> SEG7<="00000000" END CASE; END PROCESS; END ARCHITECTURE ART;(七)利用前面所设计的模块,完成交通灯信号控制器的顶层设计,并对其进行编译和仿真,初步验证设计的正确性。LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY traffic ISPORT(SB,SM, CLK, clk_scan: IN STD_LOGIC;MR1,MY1,MG1,BR1,BY1,BG1:BUFFER STD_LOGIC;-MR2,MY2,MG2,BR2,BY2,BG2:OUT STD_LOGIC;ledw:out STD_LOGIC_VECTOR(2 DOWNTO 0);seg7: OUT STD_LOGIC_VECTOR(7 DOWNTO 0);END ENTITY traffic ;ARCHITECTURE ART OF traffic ISCOMPONENT JTDKZ ISPORT(CLK, SM, SB: IN STD_LOGIC;MR, MY, MG, BR, BY, BG: OUT STD_LOGIC);END COMPONENT JTDKZ; COMPONENT time_45s IS PORT(SB,SM, CLK, EN45: IN STD_LOGIC; DOUT45M, DOUT45B: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); END COMPONENT time_45s ; COMPONENT time_25s IS PORT(SB, SM, CLK, EN25: IN STD_LOGIC; DOUT25M, DOUT25B: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); END COMPONENT time_25s;COMPONENT time_5s IS PORT(CLK, EN05M, EN05B: IN STD_LOGIC; DOUT5: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); END COMPONENT time_5s; COMPONENT XSKZ IS PORT(EN45, EN25, EN05M, EN05B:IN STD_LOGIC; A

    注意事项

    本文(交通灯信号控制设计--学士学位论文.doc)为本站会员(可****阿)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开