数字钟数电课程设计报告.docx

上传人:b****7 文档编号:10827095 上传时间:2023-02-23 格式:DOCX 页数:25 大小:235.19KB
下载 相关 举报
数字钟数电课程设计报告.docx_第1页
第1页 / 共25页
数字钟数电课程设计报告.docx_第2页
第2页 / 共25页
数字钟数电课程设计报告.docx_第3页
第3页 / 共25页
数字钟数电课程设计报告.docx_第4页
第4页 / 共25页
数字钟数电课程设计报告.docx_第5页
第5页 / 共25页
点击查看更多>>
下载资源
资源描述

数字钟数电课程设计报告.docx

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

数字钟数电课程设计报告.docx

数字钟数电课程设计报告

 

 

JIANGSUTEACHERSUNIVERSITYOFTECHNOLOGY

数字电路课程设计报告

 

(基于FPGA的数字钟设计)

一、课题要求

(1)技术要求

1)掌握QUARTUS-2软件的使用方法;

2)具备EDA技术基础,能够熟练使用VHDL语言进行编程,掌握层次化设计方法;

3)掌握多功能数字钟的工作原理,学会不同进制计数器及时钟控制电路的设计方法;

4)能根据设计要求对设计电路进行仿真和测试;

5)掌握将所设计软件下载到FPGA芯片的下载步骤等等。

6)将硬件与软件连接起来,调试电路的功能。

(2)功能要求

基本功能:

能进行正常的时、分、秒计时功能,分别由6个数码管显示24小时,60分钟,60秒钟的计数器显示。

附加功能:

1)能利用硬件部分按键实现“校时”“校分”“清零”功能;

2)能利用蜂鸣器做整点报时:

当计时到达59’55’’时开始报时,在55’’56’’57’’58’’59’’时鸣叫,共鸣叫5秒钟;

3)定时闹铃:

本设计中设置的是在六点半时进行闹钟功能,鸣叫时间为一分钟。

(3)本人工作

本人主要负责硬件安装及焊接部分!

二、设计方案

1)数字钟电路的原理框图详见末页图(a)

2)数字钟设计方案

采用同步电路,总线结构。

时钟信号分别加到各个模块,各个模块相对独立,模块间连线简单,易于扩展。

振荡器和分频器产生稳定的校时信号和计时信号。

对“秒”计时信号进行60进制计数,形成“分”计时信号和秒计数值;再对“分”计时信号进行60进制计数,形成“时”计时信号和分计数值;进一步对“时”计时信号进行24进制计数得到时计数值。

秒计数值、分计数值和时计数值译码显示时间。

3)数字钟的工作原理

数字电子钟由振荡器、分频器计数器、译码显示、报时等电路组成。

振荡器产生稳定的高频脉冲信号,作为数字钟的时间基准,然后经过分频器输出标准秒脉冲。

秒计数器满60后向分计数器进位,分计数器满60后向小时计数器进位,小时计数器按照“24翻1”规律计数。

计满后各计数器清零,重新计数。

计数器的输出分别经译码器送数码管显示,计时出现误差时,可以用校时电路“校时”“校分”“清零”。

秒脉冲可以通过分频电路得到。

通过报时设计模块可以实现整点报时及定时闹铃,译码显示由七段译码器完成,显示由数码管构成,采用的是动态显示方式。

数码管动态显示:

动态扫描电路将计数器输出的8421BGD码转换为数码管需要的逻辑状态,并且输出数码管的片选信号和为选信号。

所谓动态扫描显示方式是在显示某一位LED显示块的数据的时候,让其它位不显示,然后再显示下一位的数据。

只要保证每一位显示的时间间隔不要太大,利用人眼的视觉暂留的现象,就可以造成各位数据同时显示的假象。

一般每一位的显示时间为1~10ms。

三、单元电路设计及仿真结果与分析

(1)分频模块(fenpin)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

entityfenpinis

port(clk6:

instd_logic;

q1000,q5,q1:

outstd_logic);

endfenpin;

architectureccc_arcoffenpinis

signalx:

std_logic;

begin

process(clk6)

variablecnt:

integerrange0to24999;

begin

ifclk6'eventandclk6='1'then

ifcnt<24999then

cnt:

=cnt+1;

else

cnt:

=0;

x<=notx;

endif;

endif;

endprocess;

q1000<=x;

process(x)

variablecnt2:

integerrange0to999;

variabley:

std_logic;

begin

ifx'eventandx='1'then

ifcnt2<999then

cnt2:

=cnt2+1;

q1<='0';

else

cnt2:

=0;

q1<='1';

endif;

endif;

ifx'eventandx='1'then

y:

=noty;

endif;

q5<=y;

endprocess;

endccc_arc;

2)仿真波形:

(2)秒模块(second)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitysecondis

port(clk1,en1:

instd_logic;

qa:

outstd_logic_vector(3downto0);

co1:

outstd_logic;

qb:

outstd_logic_vector(3downto0));

endsecond;

architectureccofsecondis

signalcout2,cout1:

std_logic_vector(3downto0);

signalmm:

std_logic;

begin

process(clk1,en1)

begin

ifen1='1'then

cout2<="0000";cout1<="0000";

elsif(clk1'eventandclk1='1')then

if(cout2=5andcout1=8)thencout2<=cout2;cout1<=cout1+1;mm<='1';

elsif(cout2=5andcout1=9)thencout2<="0000";cout1<="0000";mm<='0';

elseif(cout1=9)thencout2<=cout2+1;cout1<="0000";mm<='0';

elsecout2<=cout2;cout1<=cout1+1;mm<='0';

endif;

endif;

endif;

endprocess;

co1<=mm;

qa<=cout2;

qb<=cout1;

endcc;

2)仿真波形:

(3)分模块(minute)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityminuteis

port(clk2,en2:

instd_logic;

qc:

outstd_logic_vector(3downto0);

co2:

outstd_logic;

qd:

outstd_logic_vector(3downto0));

endminute;

architecturebbofminuteis

signalcout2,cout1:

std_logic_vector(3downto0);

signalcc:

std_logic;

begin

process(clk2,en2)

begin

ifen2='1'then

if(clk2'eventandclk2='1')then

if(cout2=5andcout1=8)thencout2<=cout2;cout1<=cout1+1;cc<='1';

elsif(cout2=5andcout1=9)thencout2<="0000";cout1<="0000";cc<='0';

elseif(cout1=9)thencout2<=cout2+1;cout1<="0000";cc<='0';

elsecout2<=cout2;cout1<=cout1+1;cc<='0';

endif;

endif;

endif;

endif;

endprocess;

co2<=cc;

qc<=cout2;

qd<=cout1;

endbb

2)仿真波形:

(4)时模块(hour)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityhouris

port(clk3,en3:

instd_logic;

qe:

outstd_logic_vector(3downto0);

qf:

outstd_logic_vector(3downto0));

endhour;

architectureaaofhouris

signalcout2,cout1:

std_logic_vector(3downto0);

begin

process(clk3,en3)

begin

ifen3='1'then

if(clk3'eventandclk3='1')then

if(cout2=2andcout1=3)thencout2<="0000";cout1<="0000";

elseif(cout1=9)thencout2<=cout2+1;cout1<="0000";

elsecout2<=cout2;cout1<=cout1+1;

endif;

endif;

endif;

endif;

endprocess;

qe<=cout2;

qf<=cout1;

endaa;

2)仿真波形:

(5)数码显示驱动模块

1)程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityhhhis

port(n1,n2,n3,n4,n5,n6:

instd_logic_vector(3downto0);

a:

instd_logic_vector(2downto0);

qqq:

outstd_logic_vector(3downto0));

endhhh;

architectureddofhhhis

begin

withaselect

qqq<=n1when"000",

n2when"001",

n3when"010",

n4when"011",

n5when"100",

n6when"101",

"0000"whenothers;

enddd;

2)仿真波形:

(6)片选模块(sell)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitygggis

port(m:

instd_logic_vector(2downto0);

b:

outstd_logic_vector(5downto0));

endggg;

architectureeeofgggis

begin

withmselect

b<="100000"when"000",

"010000"when"001",

"001000"when"010",

"000100"when"011",

"000010"when"100",

"000001"when"101",

"000000"whenothers;

endee;

2)仿真波形:

(7)译码显示模块(display)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitydecoderis

port(x:

instd_logic_vector(3downto0);

y:

outstd_logic_vector(6downto0));

enddecoder;

architectureoneofdecoderis

begin

withxselect

y<="1111110"when"0000",

"0110000"when"0001",

"1101101"when"0010",

"1111001"when"0011",

"0110011"when"0100",

"1011011"when"0101",

"1011111"when"0110",

"1110000"when"0111",

"1111111"when"1000",

"1111011"when"1001",

"0000000"whenothers;

endone;

2)仿真波形:

(8)报时模块(alart)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

entitysstis

port(h1,h0,m1,m0,s1,s0:

instd_logic_vector(3downto0);

clk4:

instd_logic;

q500:

outstd_logic);

endsst;

architecturesssofsstis

begin

process(clk4,m1,m0,s1,s0)

begin

if(clk4'eventandclk4='1')then

if((h1="0000"andh0="0110"andm1="0011"andm0="0000")

or(m1="0101"andm0="1001"ands1="0101"and

(s0="0101"ors0="0110"ors0="0111"ors0="1000"ors0="1001")))then

q500<='1';

else

q500<='0';

endif;

endif;

endprocess;

endsss;

2)仿真波形:

(9)六进制计数器模块(cnt6)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycnt6is

port(clk5:

instd_logic;

n:

outstd_logic_vector(2downto0));

endcnt6;

architecturebehavofcnt6is

signalq1:

std_logic_vector(2downto0);

begin

process(clk5)

begin

ifclk5'eventandclk5='1'then

ifq1<5thenq1<=q1+1;

elseq1<=(others=>'0');

endif;

endif;

endprocess;

n<=q1;

endbehav;

2)仿真波形:

(10)两输入与模块(and2a)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

entityandais

port(a1,b1:

instd_logic;

y:

outstd_logic);

endanda;

architectureanofandais

begin

y<=a1andb1;

endan;

2)仿真波形:

(11)两输入或模块(or2a)

1)程序:

libraryieee;

useieee.std_logic_1164.all;

entityor_1is

port(a1,b1:

instd_logic;

y:

outstd_logic);

endor_1;

architectureooofor_1is

begin

y<=a1orb1;

endoo;

2)仿真波形:

四、顶层电路设计及仿真结果与分析

1)程序:

libraryieee;

useieee.std_logic_1164.all;

entitydigital_clockis

port(clk,sa,sb,sc:

instd_logic;

q1:

outstd_logic;

r:

outstd_logic_vector(5downto0);

q0:

outstd_logic_vector(6downto0));

enddigital_clock;

architecturemainofdigital_clockis

componentanda

port(a1,b1:

instd_logic;

y:

outstd_logic);

endcomponent;

componentor_1

port(a1,b1:

instd_logic;

y:

outstd_logic);

endcomponent;

componentfenpin

port(clk6:

instd_logic;

q1000,q1,q5:

outstd_logic);

endcomponent;

componenthour

port(clk3,en3:

instd_logic;

qe:

outstd_logic_vector(3downto0);

qf:

outstd_logic_vector(3downto0));

endcomponent;

componentminute

port(clk2,en2:

instd_logic;

qc:

outstd_logic_vector(3downto0);

co2:

outstd_logic;

qd:

outstd_logic_vector(3downto0));

endcomponent;

componentsecond

port(clk1,en1:

instd_logic;

qa:

outstd_logic_vector(3downto0);

co1:

outstd_logic;

qb:

outstd_logic_vector(3downto0));

endcomponent;

componentsstis

port(h1,h0,m1,m0,s1,s0:

instd_logic_vector(3downto0);

clk4:

instd_logic;

q500:

outstd_logic);

endcomponent;

componenthhh

port(n1,n2,n3,n4,n5,n6:

instd_logic_vector(3downto0);

a:

instd_logic_vector(2downto0);

qqq:

outstd_logic_vector(3downto0));

endcomponent;

componentggg

port(m:

instd_logic_vector(2downto0);

b:

outstd_logic_vector(5downto0));

endcomponent;

componentcnt6is

port(clk5:

instd_logic;

n:

outstd_logic_vector(2downto0));

endcomponent;

componentdecoder

port(x:

instd_logic_vector(3downto0);

y:

outstd_logic_vector(6downto0));

endcomponent;

signala,b,c,h,i,j,z:

std_logic;

signalk,l,e,f,u,v,t:

std_logic_vector(3downto0);

signals:

std_logic_vector(2downto0);

begin

u1:

fenpinportmap(clk6=>clk,q1=>h,q1000=>z);

u2:

secondportmap(clk1=>h,en1=>sc,qa=>k,qb=>l,co1=>I);

u0:

or_1portmap(a1=>i,b1=>sb,y=>a);

u3:

minuteportmap(clk2=>h,en2=>a,qc=>e,qd=>f,co2=>j);

u30:

andaportmap(a1=>i,b1=>j,y=>b);

u31:

or_1portmap(a1=>b,b1=>sa,y=>c);

u4:

hourportmap(clk3=>h,en3=>c,qe=>u,qf=>v);

u5:

sstportmap(h1=>u,h0=>v,m1=>e,m0=>f,s1=>k,s0=>l,clk4=>h,q500=>q1);

u6:

hhhportmap(n1=>k,n2=>l,n3=>e,n4=>f,n5=>u,n6=>v,qqq=>t,a=>s);

u7:

gggportmap(b=>r,m=>s);

u8:

cnt6portmap(n=>s,clk5=>z);

u9:

decoderportmap(x=>t,y=>q0);

endarchitecturemain;

2)仿真波形:

五、硬件电路设计与安装电路

(1)按照电路功能设计好硬件部分安装图(电路安装图详见末页图b);

(2)根据电路板的大小以及所有的元器件,大致决定好各元器件的分布情况。

注:

布线不能有交叉线,且要注意工艺问题即布线要讲究横平竖直原则。

(3)先把数码管底座插到板子上,把各个数码管之间相连接起来需要的导线准备好,用胶带贴在板子上固定好;然后再逐步增加元器件,用同样的方法布好线固定好。

注:

必须清楚共阴极数码管的各引脚以及三极管的引脚。

(4)接下来就是焊接部分,把导线引脚都焊接到板子上。

也可以在布线的过程中排好一部分线就焊接一部分,分步来。

注:

我的烙铁功率(30W)较大,焊接过程中必须快、狠、准,烙铁与焊盘接触时间不能太长否则焊盘容易脱落。

(5)由于我们需要六个数码管,相对来说,线路比较复杂,布线比较容易有交叉线,所以,不好布线的部分可以充分利用杜邦线的作用,这样电路板布局比较清楚,导线分布也比较美观。

(6)电路焊接好后,对照电路图检查一下电路。

确定电路无误后才能连接芯片调试功能。

注:

硬件电路和芯片连接时要仔细,注意程序

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

当前位置:首页 > 高等教育 > 哲学

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

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