数电课设大作业 数字钟

更新时间:2024-03-14 14:39:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

大连理工大学本科实验报告

题目:数字钟

课程名称:数字电路课程设计

学院(系):电信 专业:电气 班级:1201 学生姓名: 学号: 完成日期:2014.11.23 成绩: 2014年11月23日 课程设计得分表 考勤 课程设计50分 考试40分 作业 合计 最后得分 一、数字钟课程设计要求: 1、设计一个具有‘时’、‘分’、‘秒’的十进制数字显示(小时从00~

23)计时器。

2、整点报时。两种方法任选其一:

⑴发出仿中央人民广播电台的整点报时信号,即从59分50秒起,

每隔2秒钟发出一次低音“嘟”的信号,连续5次,最后一次要求高音“嘀”的信号,此信号结束即达到整点。“嘟”是500Hz左右的频率输出,“嘀”

是1000Hz左右的频率输出

⑵通过LED闪烁实现,闪烁频率及花型可自己设计并在这里说明。

3、手动校时、校分、校秒。

4、定时与闹钟功能,能在设定的时间发出闹铃声。 5、设计一个秒表,显示1%秒到60秒、手动停止。

6、设计一个倒计时,显示小时、分钟、秒。

7、其他创新。 第1题25分,其他每题5分 二、课程设计考试(40分,每题分):考试题目: 1、 实体名 □ 2、 计数器 □ 3、 异步清零 □ 4、 进位输出 □ 5、 仿真图 □ 6、 数码管输出 □ 7、 分频 □ 8、 元件例化 □ 9、 引脚分配 □ 10、下载 □

题目:数字钟

(1.

大连理工大学电信学院,辽宁大连,116023;

2.大连理工大学电工电子实验中心,辽宁大连,116023;)

1.设计要求

一、电子表部分:

(1)由晶振电路产生1HZ的校准秒信号。?

(2)设计一个具有‘时’、‘分’、‘秒’的十进制数字显示(小时从00~23)计时器具有手动校时、校分,校秒和清零的功能。? (3) 整点报时功能,通过LED闪烁实现,此实验LED灯亮一秒。 二、秒表部分: (1) 有晶振产生100HZ的校准0.01秒信号。 (2)设计一个有“时”、“分”、“秒”、“0.1秒”、“0.01秒”(23小时59分59秒99)显示功能 (3)具有开始计时暂停计时功能和清零功能 三、具有电子表和秒表状态切换。 四、划出框图和逻辑电路图,写出设计。 2.设计分析及系统方案设计 1设计主要分为数字钟和秒表计时两个部分并选择用二选一

数据选择器来实现两种功能切换。

2由于时钟用的是cyclone2开发板上提供的50MHz晶振的频率,所以数字时钟和秒表计时都用到分频器分频分别得到

1Hz和100Hz的时钟频率。

3数字时钟部分包括分频部分即分频器;计时部分,包含模六计数器、模十计数器;选位调节部分,分别对时钟分钟和小时部分进行调节,用二选一数据选择器实现;数字显示部分,用到6个4-16译码器,和6个数码显示管;整点报时部分,其中报时用LED灯闪烁代替;含有清零端开关。 4秒表计时包含分频器;计时器包含模六计数器,模十计数器,模三计数器;数字显示器包含有8个4-16译码器,8个数码显示管;计时启停开关,清零开关。 3.系统以及模块硬件电路设计 输入:晶振50MHz,选位开关(0为可调节,1为正常计时),数字钟清零开关(0为清零),开关切换计时状态(1为数字计时,0为秒表计时),秒表启停开关(1启动,0停止),秒表复位开关(0复位),选择输出开关(1输出数字计时数字,0输出秒表计时数字)。 输出:LED灯,数字显示部分。

输入 选位清零 晶振 开启复位 分频得分频得计时器部1 输入 0 计时器部分 整点1 选择输0 LED 输出数字显示

4系统的VHDL设计

libraryieee;

useieee.std_logic_1164.all; useieee.std_logic_unsigned.all;

entitykesheis

port(clk:instd_logic;

qo1,qo2,qo3,qo4,qo5,qo6,qo7,qo8:outstd_logic_vector

(6downto0);

rst1:instd_logic;--开关1 rst2:instd_logic;--开关2 rst3:instd_logic;--开关3 rst4:instd_logic;--开关4 switch1:instd_logic; switch2:instd_logic; key1:instd_logic;--分钟调节 key2:instd_logic;--小时调节 key3:instd_logic; runstop:instd_logic;--秒表启停开关 led:outstd_logic_vector(7downto0) ); end; architectureaofkesheis signalqh,ql,qhs,qls,qhf,qlf,qhh,qlh:std_logic_vecto

r(3downto0):=\signalrun:std_logic:='0';

signalqqh1,qqh2,qql1,qql2,qqhf1,qqhf2,qqhs1,qqhs2,q

qls1,qqls2,qqhh1,

qqhh2,qqlh1,qqlh2,qqlf1,qqlf2:std_logic_vector(3dow

nto0);

signalclk1s,csf,csh,css,clk1s2,csf2,csh2,css2,csh2i

n,csf2in,css2in:std_logic;

componentsegment

port(qi:instd_logic_vector(3downto0); qo:outstd_logic_vector(6downto0) ); endcomponent; begin u1:segmentportmap(qh,qo1); u2:segmentportmap(ql,qo2); u3:segmentportmap(qhf,qo5); u4:segmentportmap(qlf,qo6); u5:segmentportmap(qhh,qo7); u6:segmentportmap(qlh,qo8); u7:segmentportmap(qhs,qo3); u8:segmentportmap(qls,qo4);

process(rst1,qqh1,qqh2,qql1,qql2,qqhf1,qqhf2,qqhs1,qqhs2,qqls1,qqls2,qqhh1,qqhh2,qqlh1,qqlh2,qqlf1,qql

f2)--电子表秒表切换

begin

ifrst1='1'then

qh<=qqh1;qhs<=qqhs1;qhf<=qqhf1;qhh<=qqhh1;

ql<=qql1;qls<=qqls1;

qlf<=qqlf1; qlh<=qqlh1;

else qh<=qqh2; qhs<=qqhs2;qhf<=qqhf2;qhh<=qqhh2; ql<=qql2; qls<=qqls2; qlf<=qqlf2; qlh<=qqlh2; endif; endprocess; process(runstop,rst2)--秒表计停开关 begin ifrst2='0'then run<='0';

elsifrunstop'eventandrunstop='1'then

run<=notrun;

endif; endprocess;

process(clk,clk1s,rst2,run)

begin

ifrising_edge(clk)then

ifcnt=499999then cnt<=0;clk1s<='1'; elsecnt<=cnt+1; clk1s<='0'; endif; endif;ifrst2='0'then qql1<=\qqh1<=\elsifrun='1'then ifclk1s'eventandclk1s='1'then if(qql1=\qql1<=\qqh1<=\css<='1'; elseifqql1=\

qqh1<=qqh1+1; qql1<=\css<='0'; else

qql1<=qql1+1; css<='0'; endif; endif; endif; endif; endprocess; process(css,rst2) begin ifrst2='0'then qqls1<=\qqhs1<=\elsifrun='1'then if css'eventandcss='1'then if(qqls1=\qqls1<=\qqhs1<=\csf<='1';

elseifqqls1=\

qqhs1<=qqhs1+1; qqls1<=\

csf<='0'; else qqls1<=qqls1+1;

csf<='0'; endif; endif; endif;endif; endprocess; process(csf,rst2) begin ifrst1='0'then qqlf1<=\qqhf1<=\elsifrun='1'then if csf'eventandcsf='1'then if(qqlf1=\qqlf1<=\qqhf1<=\csh<='1';

elseifqqlf1=\

qqhf1<=qqhf1+1;

qqlf1<=\csh<='0'; else qqlf1<=qqlf1+1;

csh<='0'; endif; endif; endif;endif; endprocess; process(csh,rst2) begin ifrst2='0'then qqlh1<=\qqhh1<=\elsifrun='1'then if csh'eventandcsh='1'then if(qqlh1=\

qqlh1<=\qqhh1<=\elseifqqlh1=\

qqhh1<=qqhh1+1;

qqlh1<=\

else qqlh1<=qqlh1+1;

endif; endif; endif;endif; endprocess; process(clk,clk1s2,rst3) begin ifrising_edge(clk)then ifct=499999then ct<=0;clk1s2<='1'; elsect<=ct+1; clk1s2<='0'; endif; endif; ifrst3='0'then qql2<=\qqh2<=\

elsifclk1s2'eventandclk1s2='1'then if(qql2=\

qql2<=\

qqh2<=\css2<='1'; elseifqql2=\

qqh2<=qqh2+1; qql2<=\css2<='0'; else qql2<=qql2+1; css2<='0'; endif; endif; endif; endprocess; process(css2,rst4,key3) begin ifrst4='1'then css2in<=css2; else css2in<=key3;

endif; endprocess; process(css2in,rst3)

begin ifrst3='0'then qqls2<=\qqhs2<=\

elsifcss2in'eventandcss2in='1'then if(qqls2=\qqls2<=\qqhs2<=\csf2<='1'; elseifqqls2=\qqhs2<=qqhs2+1; qqls2<=\csf2<='0'; else qqls2<=qqls2+1; csf2<='0'; endif; endif; endif; endprocess;

process(csf2,switch1,key1)

begin

ifswitch1='1'then csf2in<=csf2;

else csf2in<=key1;

endif; endprocess; process(csf2in,rst3) begin ifrst3='0'then qqlf2<=\qqhf2<=\elsif csf2in'eventandcsf2in='1'then if(qqlf2=\qqlf2<=\qqhf2<=\csh2<='1'; elseifqqlf2=\

qqhf2<=qqhf2+1; qqlf2<=\csh2<='0';

else

qqlf2<=qqlf2+1; csh2<='0'; endif; endif; endif;

if(qqlf2=\s2=\elseled<=\endif; endprocess; process(csh2,switch2,key2) begin ifswitch2='1'then csh2in<=csh2; else csh2in<=key2; endif; endprocess; process(csh2in,rst3)

begin ifrst3='0'then qqlh2<=\

qqhh2<=\

elsif

csh2in'eventandcsh2in='1'then if(qqlh2=\

qqlh2<=\qqhh2<=\elseifqqlh2=\qqhh2<=qqhh2+1; qqlh2<=\else qqlh2<=qqlh2+1; endif; endif; endif; endprocess; end; libraryieee; useieee.std_logic_1164.all; useieee.std_logic_unsigned.all;

entitysegmentis

port(

qi:instd_logic_vector(3downto0);

qo:outstd_logic_vector(6downto0)

); end;

architecturebofsegmentis

begin process(qi) begin caseqiis when\when\when\when\when\when\when\when\when\when\whenothers=>qo<=\

endcase; endprocess;

end;

1分频部分

新时钟状态图如下: 2秒表电子表输出切换部分

开关判断为为0时输出为秒0 1时输出为数字计时输出,1 表计时输出。 3计时部分 模6计数器、模10计数器、模3计数器 状态转换如下: 000010000010模6计数器状态图 001001000100000100模10计数器状态图 001011001011010010000001模3计数器状态图 000

4数字显示部分

数字显示用4-16译码器中7个输出管脚连接数码管中7个共阳的发光二极管,当译码器输入四位二进制代码时,对

应数码管显示相应的数字。

\对应\显示0;\对应\

显示1; \对应\显示2;\对应\显示3; \对应\显示4;\对应\显示5; \对应\显示6;\对应\显示7; \对应\显示8;others对应\显示9; 5结论以及结果说明 本次课程设计主要在windowsXP系统运用quartus26.0版软件来进行调试。 部分仿真截图 通过本课学习到了VHDL的使用方法了解到了自己在学习上

的一些不足,谢谢老师的指导。

4数字显示部分

数字显示用4-16译码器中7个输出管脚连接数码管中7个共阳的发光二极管,当译码器输入四位二进制代码时,对

应数码管显示相应的数字。

\对应\显示0;\对应\

显示1; \对应\显示2;\对应\显示3; \对应\显示4;\对应\显示5; \对应\显示6;\对应\显示7; \对应\显示8;others对应\显示9; 5结论以及结果说明 本次课程设计主要在windowsXP系统运用quartus26.0版软件来进行调试。 部分仿真截图 通过本课学习到了VHDL的使用方法了解到了自己在学习上

的一些不足,谢谢老师的指导。

本文来源:https://www.bwwdw.com/article/e2e8.html

Top