数电实验多功能数字钟.docx

上传人:b****8 文档编号:28924772 上传时间:2023-07-20 格式:DOCX 页数:26 大小:159.66KB
下载 相关 举报
数电实验多功能数字钟.docx_第1页
第1页 / 共26页
数电实验多功能数字钟.docx_第2页
第2页 / 共26页
数电实验多功能数字钟.docx_第3页
第3页 / 共26页
数电实验多功能数字钟.docx_第4页
第4页 / 共26页
数电实验多功能数字钟.docx_第5页
第5页 / 共26页
点击查看更多>>
下载资源
资源描述

数电实验多功能数字钟.docx

《数电实验多功能数字钟.docx》由会员分享,可在线阅读,更多相关《数电实验多功能数字钟.docx(26页珍藏版)》请在冰豆网上搜索。

数电实验多功能数字钟.docx

数电实验多功能数字钟

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

 

题目:

多功能数字钟

 

课程名称:

《数字电路课程设计》

学院(系):

电子信息与电气工程学部

专业:

自动化

班级:

电自0801

学生姓名:

学号:

200881142

完成日期:

2011年7月20日

成绩:

 

2011年7月20日

题目:

多功能数字钟

1设计要求

(1)一个具有“时”,“分”,“秒”的十进制数字显示(小时从00~23)计时器。

(2)具有手动校时,校分的功能。

(3)定时与闹钟功能,能在设定的时间发出闹铃声

(4)能整点报时。

要求从59分54秒起报时,每隔2秒发出低音,,连续3次,在整点要求是高音。

2设计分析及系统方案设计

系统总体结果

系统设计要求说明:

(1)该秒表用模24、模60计数器实现24小时计时

(2)在调节闹钟时不影响数字钟的正常走表;

(3)在调节闹钟时要通过数码管显示出;

3系统以及模块硬件电路设计

根据上述给出的系统总体结构框图,给出系统硬件电路设计,并作必要的说明和理论计算。

由于“数字电路课程设计”课程采用实验箱完成,没有学时涉及有关FPGA芯片的使用,因此有关FPGA芯片的部分可以用“FPGA最小系统”模块框代替。

其余接口部分(按键,LED以及数码管,各种接口等需要设计电路以及参数)。

下载时选择的开发系统模式以及管脚定义

表1GW48-CK开发系统工作模式:

模式0

接口

名称

类型

(输入/输出)

结构图上

的信号名

引脚号

说明

en

输入

PIO7

16

手动校时(1-调时,0-走表)

th

输入

PIO6

11

调时按键(en=1,或en1=1调时)

en1

输入

PIO5

10

闹钟设定(1-调时,0-不走)

tm

输入

PIO4

9

调分按键(en=1或en1=1,才可调分)

alarmstop

输入

PIO3

8

闹铃控制端

clk

输入

CLOCK1

42

系统走表时钟(f=1Hz)

clk1

输入

CLOCK0

2

闹钟与整点报时时钟(f=256Hz)

clk2

输入

CLOCK5

83

整点报时时钟时钟(f=1024Hz)

qhh

输出

PIO47-PIO44

79、78、73、72

输出小时的高位

qlh

输出

PIO43-PIO40

71、70、67、66

输出小时的低位

qhm

输出

PIO39-PIO36

65、64、62、61

输出分钟的高位

qlm

输出

PIO35-PIO32

60、59、58、54

输出分钟的低位

qhs

输出

PIO31-PIO28

53、52、51、50

输出秒的高位

qls

输出

PIO27-PIO24

49、48、47、39

输出秒的低位

speaker

输出

SPEAKER

3

输出蜂鸣器的时钟

4系统的VHDL设计

系统的各个部分如何用VHDL设计出来的应该有说明,包括论述以及真值表或者状态图等。

要求:

系统(或顶层文件)结构描述,各个模块(或子程序)的功能描述;

1)用原理图实现的,需包含以下内容:

(1)系统原理图

(2)主要模块或符号说明;

主要模块:

模60计数器,模24计数器,

2)用VHDL语言实现的

(1)秒计数器(模60计数器)

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitym_601is

port(clk:

instd_logic;

clk_1:

outstd_logic;--clk_1表进位

qh,ql:

outstd_logic_vector(3downto0)–qh,ql表示十位与个位

);

end;

architectureaofm_601is

signalqqh,qql:

std_logic_vector(3downto0);

signaltmp:

std_logic;

begin

process(clk)

begin

ifclk'eventandclk='1'then

ifqql=9then

qql<="0000";

ifqqh=5then

qqh<="0000";tmp<='1';

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

tmp<='0';

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

clk_1<=tmp;

end;

秒计数器仿真图

(2)分计数器(模60计数器)

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitym_60is

port(clk,en,t:

instd_logic;--在en=1控制的情况下,手动t校时

clk_1:

outstd_logic;--clk_1表进位

qh,ql:

outstd_logic_vector(3downto0)–qh,ql表十位与个位

);

end;

architectureaofm_60is

signalqqh,qql:

std_logic_vector(3downto0);

signaltmp,tmp_1:

std_logic;

begin

process(tmp_1)

begin

iftmp_1'eventandtmp_1='1'then

ifqql=9then

qql<="0000";

ifqqh=5then

qqh<="0000";tmp<='1';

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

tmp<='0';

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

clk_1<=tmp;

process(en,clk,t)

begin

ifen='0'then

tmp_1<=clk;

else

tmp_1<=t;

endif;

endprocess;

end;

分计数器仿真图

(3)小时计数器(模24计数器)

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitym_24is

port(clk,en,t:

instd_logic;--在en=1控制的情况下,手动t校时

qh,ql:

outstd_logic_vector(3downto0)—qh,ql表十位与个位

);

end;

architectureaofm_24is

signaltmp:

std_logic;

signalqqh,qql:

std_logic_vector(3downto0);

begin

process(en,tmp,t)

begin

ifen='0'then

tmp<=clk;

else

tmp<=t;

endif;

endprocess;

process(tmp)

begin

iftmp'eventandtmp='1'then

ifqql=9or(qql=4andqqh=2)then

qql<="0000";

ifqqh=2then

qqh<="0000";

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

end;

小时计数器(模24计数器)仿真图

(4)闹钟分钟计数器(模60计数器)

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitym_60bis

port(clk,en:

instd_logic;--在en=1是,手动给clk,闹钟加1;

qh,ql:

outstd_logic_vector(3downto0)

);

end;

architectureaofm_60bis

signalqqh,qql:

std_logic_vector(3downto0);

begin

process(en,clk)

begin

ifclk'eventandclk='1'then

ifen='1'then

ifqql=9then

qql<="0000";

ifqqh=5then

qqh<="0000";

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

endif;

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

end;

闹钟分钟计数器(模60计数器)仿真图

(5)闹钟小时计数器(模24计数器)

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitym_24bis

port(clk,en:

instd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

end;

architectureaofm_24bis

signalqqh,qql:

std_logic_vector(3downto0);

begin

process(clk,en)

begin

ifclk'eventandclk='1'then

ifen='1'then

ifqql=9or(qql=4andqqh=2)then

qql<="0000";

ifqqh=2then

qqh<="0000";

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

endif;

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

end;

闹钟小时计数器(模24计数器)仿真图

(6)整个系统程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

-------分钟模60计数器-------

entitym_60is

port(clk,en,t:

instd_logic;

clk_1:

outstd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

end;

architectureaofm_60is

signalqqh,qql:

std_logic_vector(3downto0);

signaltmp,tmp_1:

std_logic;

begin

process(tmp_1)

begin

iftmp_1'eventandtmp_1='1'then

ifqql=9then

qql<="0000";

ifqqh=5then

qqh<="0000";tmp<='1';

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

tmp<='0';

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

clk_1<=tmp;

process(en,clk,t)

begin

ifen='0'then

tmp_1<=clk;

else

tmp_1<=t;

endif;

endprocess;

end;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

----------校分模60计数器---------

entitym_60bis

port(clk,en:

instd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

end;

architectureaofm_60bis

signalqqh,qql:

std_logic_vector(3downto0);

begin

process(en,clk)

begin

ifclk'eventandclk='1'then

ifen='1'then

ifqql=9then

qql<="0000";

ifqqh=5then

qqh<="0000";

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

endif;

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

end;

 

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

-------秒表模60计数器-----

entitym_601is

port(clk:

instd_logic;

clk_1:

outstd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

end;

architectureaofm_601is

signalqqh,qql:

std_logic_vector(3downto0);

signaltmp:

std_logic;

begin

process(clk)

begin

ifclk'eventandclk='1'then

ifqql=9then

qql<="0000";

ifqqh=5then

qqh<="0000";tmp<='1';

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

tmp<='0';

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

clk_1<=tmp;

end;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

------校时模24计数器------

entitym_24bis

port(clk,en:

instd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

end;

architectureaofm_24bis

signalqqh,qql:

std_logic_vector(3downto0);

begin

process(clk,en)

begin

ifclk'eventandclk='1'then

ifen='1'then

ifqql=9or(qql=4andqqh=2)then

qql<="0000";

ifqqh=2then

qqh<="0000";

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

endif;

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

end;

 

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

------小时模24计数器------

entitym_24is

port(clk,en,t:

instd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

end;

architectureaofm_24is

signaltmp:

std_logic;

signalqqh,qql:

std_logic_vector(3downto0);

begin

process(en,tmp,t)

begin

ifen='0'then

tmp<=clk;

else

tmp<=t;

endif;

endprocess;

process(tmp)

begin

iftmp'eventandtmp='1'then

ifqql=9or(qql=4andqqh=2)then

qql<="0000";

ifqqh=2then

qqh<="0000";

else

qqh<=qqh+1;

endif;

else

qql<=qql+1;

endif;

endif;

endprocess;

qh<=qqh;

ql<=qql;

end;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitytop4is

port(clk,clk1,clk2,en,en1,th,tm,alarmstop:

instd_logic;

--clk:

系统走表时钟(f=1Hz);clk1:

闹钟与整点报时时钟(f=256Hz);

clk2:

整点报时时钟(f=1024Hz);en.en1:

分别是校时、校分与调闹铃的使能端;th,tm:

是手动调节小时与分钟的时钟--------

qls,qhs,qlm,qhm,qlh,qhh:

outstd_logic_vector(3downto0);

--分别表示秒低高位,分高低位,时高低位--

speaker:

outstd_logic);speaker:

是喇叭

end;

architectureaoftop4is

componentm_60

port(clk,en,t:

instd_logic;

clk_1:

outstd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

endcomponent;

componentm_601

port(clk:

instd_logic;

clk_1:

outstd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

endcomponent;

componentm_60b

port(clk,en:

instd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

endcomponent;

componentm_24

port(clk,en,t:

instd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

endcomponent;

componentm_24b

port(clk,en:

instd_logic;

qh,ql:

outstd_logic_vector(3downto0)

);

endcomponent;

signalfulls,fullm:

std_logic;---秒、分进位---

signal:

qhhtmp,qlhtmp,qhmtmp,qlmtmp,qhhaltmp,qlhaltmp,qhmaltmp,

qlmaltmp,qlstmp,qhstmp:

std_logic_vector(3downto0);

--秒,分,时中间信号--

signalspeaker1,speaker2:

std_logic;--闹钟与整点报时的中间信号

begin

u1:

m_601portmap(clk,fulls,qhstmp,qlstmp);

u2:

m_60portmap(fulls,en,tm,fullm,qhmtmp,qlmtmp);

u3:

m_24portmap(fullm,en,th,qhhtmp,qlhtmp);

u4:

m_24bportmap(th,en1,qhhaltmp,qlhaltmp);

u5:

m_60bportmap(tm,en1,qhmaltmp,qlmaltmp);

process(en1,qhhaltmp,qlhaltmp,qhmaltmp,qlmaltmp,qhhtmp,qlhtmp,

qhmtmp,qlmtmp)

begin

ifen1='1'then----在闹钟调节时,把闹钟显示的界面显示出来并且不影响时钟的正常走表----

qhh<=qhhaltmp;qlh<=qlhaltmp;

qhm<=qhmaltmp;qlm<=qlmaltmp;

qhs<="0000";qls<="0000";

else---在en=0时显示正常走表---

qhs<=qhstmp;qls<=qlstmp;

qhh<=qhhtmp;qlh<=qlhtmp;

qhm<=qhmtmp;qlm<=qlmtmp;

endif;

endprocess;

----------闹钟---------

process(alarmstop,qhhaltmp,qlhaltmp,qhmaltmp,qlmaltmp,qhhtmp,qlhtmpqhmtmp,qlmtmp),

----当到预设时间时别且alarmstop=0是每隔2秒响一次----

begin

ifqhhaltmp=qhhtmpandqlhaltmp=qlhtmpandqhmaltmp=qhmtmpand

qlmaltmp=qlmtmp

and(qlstmp=1orqlstmp=3orqlstmp=5orqlstmp=7orqlstmp=9)

then

ifalarmstop='0'then

speak

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

当前位置:首页 > 法律文书 > 起诉状

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

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