数电课设大作业数字钟.docx

上传人:b****8 文档编号:9844641 上传时间:2023-02-07 格式:DOCX 页数:22 大小:311.39KB
下载 相关 举报
数电课设大作业数字钟.docx_第1页
第1页 / 共22页
数电课设大作业数字钟.docx_第2页
第2页 / 共22页
数电课设大作业数字钟.docx_第3页
第3页 / 共22页
数电课设大作业数字钟.docx_第4页
第4页 / 共22页
数电课设大作业数字钟.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

数电课设大作业数字钟.docx

《数电课设大作业数字钟.docx》由会员分享,可在线阅读,更多相关《数电课设大作业数字钟.docx(22页珍藏版)》请在冰豆网上搜索。

数电课设大作业数字钟.docx

数电课设大作业数字钟

Documentnumber【SA80SAB-SAA9SYT-SAATC-SA6UT-SA18】

 

数电课设大作业数字钟

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

 

题目:

数字钟

 

课程名称:

数字电路课程设计

学院(系):

电信

专业:

电气

班级:

1201

学生姓名:

学号:

完成日期:

成绩:

 

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的校准秒信号。

(2)设计一个有“时”、“分”、“秒”、“秒”、“秒”(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灯,数字显示部分。

整点计时

4系统的VHDL设计

libraryieee;

usekesheis

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_vector(3downto0):

="0000";

signalrun:

std_logic:

='0';

signalcnt,ct:

integerrange0to;

signalqqh1,qqh2,qql1,qql2,qqhf1,qqhf2,qqhs1,qqhs2,qqls1,qqls2,qqhh1,

qqhh2,qqlh1,qqlh2,qqlf1,qqlf2:

std_logic_vector(3downto0);

signalclk1s,csf,csh,css,clk1s2,csf2,csh2,css2,csh2in,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,qqlf2)--电子表秒表切换

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<="0000";

qqh1<="0000";

elsifrun='1'then

ifclk1s'eventandclk1s='1'then

if(qql1="1001"andqqh1="1001")then

qql1<="0000";

qqh1<="0000";

css<='1';

elseifqql1="1001"then

qqh1<=qqh1+1;

qql1<="0000";

css<='0';

else

qql1<=qql1+1;

css<='0';

endif;

endif;

endif;

endif;

endprocess;

process(css,rst2)

begin

ifrst2='0'then

qqls1<="0000";

qqhs1<="0000";

elsifrun='1'then

if

css'eventandcss='1'then

if(qqls1="1001"andqqhs1="0101")then

qqls1<="0000";

qqhs1<="0000";

csf<='1';

elseifqqls1="1001"then

qqhs1<=qqhs1+1;

qqls1<="0000";

csf<='0';

else

qqls1<=qqls1+1;

csf<='0';

endif;

endif;

endif;endif;

endprocess;

process(csf,rst2)

begin

ifrst1='0'then

qqlf1<="0000";

qqhf1<="0000";

elsifrun='1'then

if

csf'eventandcsf='1'then

if(qqlf1="0011"andqqhf1="0010")then

qqlf1<="0000";

qqhf1<="0000";

csh<='1';

elseifqqlf1="1001"then

qqhf1<=qqhf1+1;

qqlf1<="0000";

csh<='0';

else

qqlf1<=qqlf1+1;

csh<='0';

endif;

endif;

endif;endif;

endprocess;

process(csh,rst2)

begin

ifrst2='0'then

qqlh1<="0000";

qqhh1<="0000";

elsifrun='1'then

if

csh'eventandcsh='1'then

if(qqlh1="1001"andqqhh1="0101")then

qqlh1<="0000";

qqhh1<="0000";

elseifqqlh1="1001"then

qqhh1<=qqhh1+1;

qqlh1<="0000";

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<="0000";

qqh2<="0000";

elsifclk1s2'eventandclk1s2='1'then

if(qql2="1001"andqqh2="1001")then

qql2<="0000";

qqh2<="0000";

css2<='1';

elseifqql2="1001"then

qqh2<=qqh2+1;

qql2<="0000";

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<="0000";

qqhs2<="0000";

elsifcss2in'eventandcss2in='1'then

if(qqls2="1001"andqqhs2="0101")then

qqls2<="0000";

qqhs2<="0000";

csf2<='1';

elseifqqls2="1001"then

qqhs2<=qqhs2+1;

qqls2<="0000";

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<="0000";

qqhf2<="0000";

elsif

csf2in'eventandcsf2in='1'then

if(qqlf2="0011"andqqhf2="0010")then

qqlf2<="0000";

qqhf2<="0000";

csh2<='1';

elseifqqlf2="1001"then

qqhf2<=qqhf2+1;

qqlf2<="0000";

csh2<='0';

else

qqlf2<=qqlf2+1;

csh2<='0';

endif;

endif;

endif;

if(qqlf2="0000"andqqhf2="0000"andqqls2="0000"andqqhs2="0000")then

led<="";

elseled<="00000000";

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<="0000";

qqhh2<="0000";

elsif

csh2in'eventandcsh2in='1'then

if(qqlh2="0011"andqqhh2="0010")then

qqlh2<="0000";

qqhh2<="0000";

elseifqqlh2="1001"then

qqhh2<=qqhh2+1;

qqlh2<="0000";

else

qqlh2<=qqlh2+1;

endif;

endif;

endif;

endprocess;

end;

libraryieee;

usesegmentis

port(

qi:

instd_logic_vector(3downto0);

qo:

outstd_logic_vector(6downto0)

);

end;

architecturebofsegmentis

begin

process(qi)

begin

caseqiis

when"0000"=>qo<="1000000";

when"0001"=>qo<="1111001";

when"0010"=>qo<="0100100";

when"0011"=>qo<="0110000";

when"0100"=>qo<="0011001";

when"0101"=>qo<="0010010";

when"0110"=>qo<="0000010";

when"0111"=>qo<="1111000";

when"1000"=>qo<="0000000";

when"1001"=>qo<="0010000";

whenothers=>qo<="1111111";

endcase;

endprocess;

end;

1分频部分

设计说明:

开发板提供50MHz时钟,我们需要的是1Hz和100Hz时钟,所以我们需要将原时钟进行分频和500000分频,找变量counter从0计数到,当其小于时时钟为0,大于等于时翻转时钟为1,得到1Hz新时钟,同理可得100Hz新时钟。

新时钟状态图如下:

2秒表电子表输出切换部分

开关判断为1时输出为数字计时输出,为0时输出为秒表计时输出。

3计时部分

模6计数器、模10计数器、模3计数器

状态转换如下:

4数字显示部分

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

"0000"对应"1000000"显示0;"0001"对应"1111001"显示1;

"0010"对应"0100100"显示2;"0011"对应"0110000"显示3;

"0100"对应"0011001"显示4;"0101"对应"0010010"显示5;

"0110"对应"0000010"显示6;"0111"对应"1111000"显示7;

"1000"对应"0000000"显示8;others对应"0010000"显示9;

5结论以及结果说明

本次课程设计主要在windowsXP系统运用quartus2版软件来进行调试。

部分仿真截图

通过本课学习到了VHDL的使用方法了解到了自己在学习上的一些不足,谢谢老师的指导。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 人文社科 > 教育学心理学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1