计数器及数码显示综合设计—课程设计报告_第1页
计数器及数码显示综合设计—课程设计报告_第2页
计数器及数码显示综合设计—课程设计报告_第3页
计数器及数码显示综合设计—课程设计报告_第4页
计数器及数码显示综合设计—课程设计报告_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

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

文档简介

1、eda技术综合设计课程设计报告报告题目: 计数器及数码显示综合设计 作者所在系部: 电子工程系 作者所在专业: 自动化专业 作者所在班级: b11222 作 者 姓 名 : 指导教师姓名: 完 成 时 间 : 1内 容 摘 要 在quatrusii 中 利用vhdl语言编写数码管显示程序,然后进行功能仿真,然后进行锁定引脚,然后硬件进行下载,调试。关键词: vhdl,数码管显示,quatrusii,时序仿真图。 目 录 内 容 摘 要i目 录ii课程设计任务书iii一、 实验目的1二、硬件要求1三、方案论证1四、模块说明21.计数器(counter60)22.计数器(counter16)33.

2、计数器(counter12)44.计数器(counter10)56.译码器(deled)77.分频器(div)88.顶层文件9五、图7计数显示的整体连接图11六、实验步骤11七、实验结果12八、总结12九、参考文献12课程设计任务书课题名称计数器及数码显示综合设计完成时间2013-12-03 指导教师崔瑞雪职称副教授学生姓名班 级b11222总体设计要求和技术要点利用vhdl进行数字钟设计,主要完成以下功能:一、 实验目的1、设计一个带使能输入、进位输出及同步清0的增1十进制计数器。2、设计一个带使能输入及同步清0的增1十二进制计数器。3、设计一个带使能输入及同步清0的六十进制同步加法计数器。

3、4、设计一个四位二进制可逆计数器。5、设计一个共阴7段数码管控制接口,要求:在时钟信号的控制下,使7位数码管动态刷新显示上述计数器的计数结果。 工作内容及时间进度安排课程设计成果1 213一、 实验目的1. 熟悉quarate工具软件2. 熟悉vhdl语言设计3. 学习eda课程的综合设计4. 学习计数器的vhdl语言设计5. 了解器件编程和下载及硬件接口连接. 二、硬件要求1. 主芯片epf10k10lc84-4。2. 7个八段扫描共阴极数码显示管。3. 三个按键开关(使能端,清零端,可逆端)。三、方案论证本次设计中将任务分成几个部来完成分别是:分频部分、十进制计数器、十二进制计数器、十六进

4、制可逆计数器、六十进制计数器、译码部分、时间扫描模块和顶层文件。分频部分:在这个部分里,接受20mhz的频率,然后分出1hz的计数频率和100hz的扫描频率。十进制计数器、十二进制计数器、六十进制计数器:在这个部分中要实现带使能输入、同步清0的增1十进制、十二进制、六十进制的计数器计数功能。使能端en高电平有效计数器开始计数,高电平停止计数,清零端clr高电平清零低电平正常计数。十六进制可逆计数器:在这个部分中要实现带使能输入、同步清0的增1十六进制的可逆计数器计数功能。计数部分分为计数的个位和十位,使能端en高电平有效计数器开始计数,低电平停止计数,清零端rst高电平清零低电平计数,可逆计数

5、器的控制端plus_sub低电平实现加法计数器的功能,高电平实现减法计数器的功能。分时扫描及译码部分:在这个部分需设计一个共阴7段数码管控制接口,在时钟信号的控制下,分时选择数码管显示相应计数器的计数脉冲,使7位数码管动态刷新显示4个计数器的计数结果,并将送来的计数器的计算值转换为相应的段码在数码管上显示计数脉冲的个数。顶层文件:在这一部分确定上述几个部分中相应输入输出端口的连接关系。四、模块说明计数器及数码显示的设计共化分为3个模块:计数器,扫描电路(seltime),译码电路(deled)。下面具体分析各个模块的原理、内容和功能。1.计数器(counter60)能够实现60进制循环计数,带

6、有清零端clr ,受时钟上升沿信号控制,其文本语言(文件名:count60er.vhd)为底层文本,图1为计数器的仿真波形图。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity counter60 isport(en,clr,clk:in std_logic; ql,qh:buffer std_logic_vector(3 downto 0);end counter60;architecture behave of counter60 isbeginprocess(en,clr,clk)

7、beginif(en=1)thenif(clkevent and clk=1)thenif(clr=1)then ql0); qh0); elsif(ql=9)then if(qh=5)then qh=0000; ql=0000; else qh=qh+1; ql=0000; end if; else ql=ql+1; end if; end if; end if; end process; end behave;图1. 六十进制秒计数器的仿真波形2.计数器(counter16)能够实现16进制可逆循环计数,带有清零端clr ,受时钟上升沿信号控制,其文本语言(文件名:count16er.vh

8、d)为底层文本,图2为计数器的仿真波形图。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity counter16 isport(en,clr,clk:in std_logic; plus_sub:in std_logic; ql,qh:buffer std_logic_vector(3 downto 0);end counter16;architecture behave of counter16 isbeginprocess(en,clr,clk,plus_sub)beginif(en

9、=1)thenif(clkevent and clk=1)then if(clr=1)then ql0); qh0); elsif(plus_sub=1)then if(qh=1 and ql=5)then ql=0000; qh=0000; elsif(ql=9)then qh=0001; ql=0000; else ql=ql+1; end if; elsif(plus_sub=0)then if(qh=0 and ql=0)then ql=0101; qh=0001; elsif(ql=0)then ql=1001; qh=0000; else ql=ql-1; end if; end

10、if; end if; end if; end process; endbehave; 图2. 十六进制分计数器的仿真波形3.计数器(counter12)能够实现12进制循环计数,带有清零端clr ,受时钟上升沿信号控制,其文本语言(文件名:count12er.vhd)为底层文本,图3为计数器的仿真波形图。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity counter12 isport(en,clr,clk:in std_logic; ql,qh:buffer std_logic_v

11、ector(3 downto 0);end counter12;architecture behave of counter12 isbeginprocess(en,clr,clk)beginif(en=1)thenif(clkevent and clk=1)thenif(clr=1)then ql0); qh0);elsif(qh=1 and ql=1)then ql=0000; qh=0000; elsif(ql=9)then qh=0001; ql=0000; else ql=ql+1; end if; end if; end if; end process; end behave;图3

12、. 十二进制分计数器的仿真波形4.计数器(counter10)能够实现10进制循环计数,带有清零端clr ,受时钟上升沿信号控制,其文本语言(文件名:count10er.vhd)为底层文本,图4为计数器的仿真波形图。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity counter10 isport(en,clr,clk:in std_logic; q:buffer std_logic_vector(3 downto 0);end counter10;architecture behav

13、e of counter10 isbeginprocess(clr,clk,en)beginif(en=1) thenif(clkevent and clk=1)thenif(clr=1)then q0);elsif(q=9)then q=0000; else q=q+1; end if; end if; end if; end process; end behave; 图4. 十进制分计数器的仿真波形5.扫面器(seltime)此模块能够实现分别对前边的数值进行扫描,有清零段,复位段,以及上升沿有效,其文本语言(文件名:seltime.vhd)为底层文本,图5为计数器的仿真波形图。libra

14、ry ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity seltime isport( clk1,ret:in std_logic; q10,q12l,q12h,q16l,q16h,q60l,q60h:in std_logic_vector(3 downto 0); q:out std_logic_vector(3 downto 0); sel:out std_logic_vector( 2 downto 0); end seltime; ar

15、chitecture behave of seltime is signal count:std_logic_vector(2 downto 0); begin sel=count; process(clk1,ret) begin if(ret=1)then count=001; elsif(clk1event and clk1=1)then if(count=7)then count=001; else countqqqqqqqnull; end case; end process; end behave; 图5. 扫描器的仿真波形6.译码器(deled)此模块能够实现分别对前边的数值进行扫

16、描,有清零段,复位段,以及上升沿有效,其文本语言(文件名:deled.vhd)为底层文本,图6为计数器的仿真波形图。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity deled isport( num:in std_logic_vector(3 downto 0); led:out std_logic_vector(6 downto 0); end deled;architecture behave of deled is begin led=1111110when num=0000e

17、lse 0110000when num=0001else 1101101when num=0010else 1111001when num=0011else 0110011when num=0100else 1011011when num=0101else 1011111when num=0110else 1110000when num=0111else 1111111when num=1000else 1111011when num=1001else 1110111when num=1010else 0011111when num=1011else 1001110when num=1100e

18、lse 0111101when num=1101else 1001111when num=1110else 1000111when num=1111; end behave; 图6. 译码器的仿真波形7.分频器(div)此模块能够实现对接受的20mhz的频率进行分频,分别得到1hz的计数频率,和100hz的扫描频率。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity div isport( clk:in std_logic; fclk100:buffer std_logic; fclk1

19、:buffer std_logic); end div;architecture behave of div is signal c0 :std_logic_vector(25 downto 0); signal c1 :std_logic_vector(25 downto 0); begin process(clk) begin if(clkevent and clk=1)then if(c0=20000000)then c0=00000000000000000000000000; fclk1=not fclk1; else c0=c0+1; end if; end if; if(clkev

20、ent and clk=1)then if(c1=200000)then c1=00000000000000000000000000; fclk100=not fclk100; else c1=c1+1; end if; end if; end process; end behave; 8.顶层文件 利用元件例化,对各个模块进行连线。 library ieee;use ieee.std_logic_1164.all;entity over isport(plus_sub, clk,en,clr,ret:in std_logic; sel:out std_logic_vector(2 downt

21、o 0); led:out std_logic_vector(6 downto 0); end over; architecture behave of over is component div port( clk:in std_logic; fclk:buffer std_logic); end component; component counter10 port(en,clr,clk:in std_logic; q:buffer std_logic_vector(3 downto 0); end component; component counter12 port(en,clr,cl

22、k:in std_logic; ql,qh:buffer std_logic_vector(3 downto 0); end component; component counter60 port(en,clr,clk:in std_logic; ql,qh:buffer std_logic_vector(3 downto 0); end component; component counter16 port(en,clr,clk:in std_logic; plus_sub:in std_logic; ql,qh:buffer std_logic_vector(3 downto 0); en

23、d component; component seltime port( clk1,ret:in std_logic; q10,q12l,q12h,q16l,q16h,q60l,q60h:in std_logic_vector(3 downto 0); q:out std_logic_vector(3 downto 0); sel:out std_logic_vector( 2 downto 0); end component; component deled port( num:in std_logic_vector(3 downto 0); led:out std_logic_vector

24、(6 downto 0); end component; signal fcl_k: std_logic; signal q_10:std_logic_vector(3 downto 0); signal q_12l:std_logic_vector(3 downto 0); signal q_12h:std_logic_vector(3 downto 0); signal q_60l:std_logic_vector(3 downto 0); signal q_60h:std_logic_vector(3 downto 0); signal q_16l:std_logic_vector(3

25、downto 0); signal q_16h:std_logic_vector(3 downto 0); signal q_q:std_logic_vector(3 downto 0); begin u1:counter10 port map(en,clr,fcl_k,q_10); u2:counter12 port map(en,clr,fcl_k,q_12l,q_12h); u3:counter60 port map(en,clr,fcl_k,q_60l,q_60h); u4:counter16 port map(en,clr,fcl_k,plus_sub,q_16l,q_16h); u5:seltime port map(clk,ret,q_10,q_12l,q_12h,q_60l,q_60h,q_16l,q_16h,q_q,sel); u6:deled

温馨提示

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

评论

0/150

提交评论