EDA数字电子钟课程报告.docx

上传人:b****5 文档编号:3565414 上传时间:2022-11-23 格式:DOCX 页数:15 大小:102.86KB
下载 相关 举报
EDA数字电子钟课程报告.docx_第1页
第1页 / 共15页
EDA数字电子钟课程报告.docx_第2页
第2页 / 共15页
EDA数字电子钟课程报告.docx_第3页
第3页 / 共15页
EDA数字电子钟课程报告.docx_第4页
第4页 / 共15页
EDA数字电子钟课程报告.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

EDA数字电子钟课程报告.docx

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

EDA数字电子钟课程报告.docx

EDA数字电子钟课程报告

 

课程设计报告

 

课程名称:

EDA课程设计

专业:

测控技术与仪器

班级:

测控一班

指导老师:

同组成员:

 

2011年12月

数字电子钟设计

摘要:

本课程设计侧重于逻辑电路设计同时采用VHDL硬件描述语言辅助完成对数字电子钟电路的功能仿真。

在设计过程中,重点探讨了数字电子时钟的设计思路和功能模块的划分,对设计过程中出现的问题详细进行分析。

系统主要由五个模块组成:

时钟脉冲模块、计时模块、译码显示模块、复位模块、校时模块。

关键词:

数字电子钟VHDL功能模块

一.系统设计内容及要求

1.系统设计内容

(1)根据电路特点,用层次设计概念,将此设计任务分成若干模块,规定每一模块的功能和各模块之间的接口,同时加深层次化设计概念;

(2)软件的元件管理深层含义,以及模块元件之间的连接概念,对于不同目录下的同一设计,如何融合;

(3)适配划分前后的仿真内容有何不同概念,仿真信号对象有何不同,有更深一步了解;

(4)按适配划分后的引脚锁定,同相关功能模块硬件电路的接口连线;

(5)所有模块采用VHDL硬件描述语言设计。

2.系统设计要求

设计一台能显示时、分、秒的数字电子钟,具体要求如下:

(1)由试验箱上的时钟信号经分频产生秒计数脉冲;

(2)时计数器用24进制计时电路,分、秒计数器用60进制计分、计秒电路;

(3)可手动校时,能分别进行时、分的校正;

(4)能实现整点报时功能。

二.系统硬件设计

1.系统设计思路

要实现一个数字电子时钟系统,整个系统由主要模块电路和外部输入输出端口以及显示模块组成。

首先分别实现单个模块的功能,然后再通过级联组合的方式实现对整个系统的设计。

其中,主要模块有五个,包括脉冲信号产生模块、时间计数模块(计数模块又分为时计数模块、分计数模块、秒计数模块)、译码显示模块、复位模块和校时模块。

各个模块先用EDA技术中的VHDL语言编程仿真,再生成各个模块的模拟元件,最后根据设计连接电路生成顶层原理图文件实现数字电子钟系统。

2.整体设计方案框架图

图1-1

3.顶层文件原理图

图1-2

4.时序仿真及分析

图1-3

时序仿真分析:

程序仿真主要由计数器完成,在时钟脉冲作用下,完成始终功能,由时序图可以看出每个时钟上升沿到来时加一,当接受到REST信号,即REST为高电平,所有计数为零,并重新计数,SETMIN和SETHOUR可以完成调节时钟功能,都是高电平调节,每来一个脉冲,相应的时或分加1。

三.系统电路模块设计

1.分频模块FENPIN设计

模块FENPIN原理图如下:

图1-4

FENPIN源程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityfenpinis

port(clk:

instd_logic;

clk1:

outstd_logic);

end;

architectureoneoffenpinis

signala:

std_logic_vector(8downto0);

signalb:

std_logic;

begin

process(clk)

begin

ifclk'eventandclk='1'then

ifa="100000000"then

b<='1';

a<="000000000";

else

a<=a+1;

b<='0';

endif;

endif;

endprocess;

clk1<=b;

end;

仿真波形如下:

图1-5

2秒计数模块SECOND设计

模块SECOND原理图如下:

图1-6

SECOND源程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitysecondis

port(clk1,reset,setmin:

instd_logic;

daout:

outstd_logic_vector(6downto0);

enmin:

bufferstd_logic);

end;

architecturetwoofsecondis

signald:

std_logic_vector(6downto0);

signalenmin1,enmin2:

std_logic;

begin

process(clk1,reset,setmin)

begin

ifreset='1'

thend<="0000000";

elsif(clk1'eventandclk1='1')then

ifd<16#60#then

ifd="1011001"then

d<="0000000";enmin1<='1';

elsed<=d+1;enmin1<='0';

ifd(3downto0)="1001"thend<=d+7;

endif;endif;

endif;endif;endprocess;

daout<=d;

enmin<=(enmin1orenmin2);

enmin2<=(setminandclk1);

end;

仿真波形如下:

图1-7

3.分计数模块MINUTE设计

模块MINUTE原理图如下:

图1-8

MINUTE源程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityminuteis

port(reset,clk2,sethour,clk1:

instd_logic;

daout:

outstd_logic_vector(6downto0);

enhour:

bufferstd_logic);

end;

architecturetwoofminuteis

signald:

std_logic_vector(6downto0);

signalenhour1,enhour2:

std_logic;

begin

process(clk2,clk1,reset,sethour)

begin

ifreset='1'

thend<="0000000";

elsif(clk2'eventandclk2='1')then

ifd<16#60#then

ifd="1011001"then

d<="0000000";enhour1<='1';

elsed<=d+1;enhour1<='0';

ifd(3downto0)="1001"thend<=d+7;

endif;

endif;

endif;

endif;

endprocess;

daout<=d;

enhour<=(enhour1orenhour2);

enhour2<=(sethourandclk1);

end;

波形仿真如下:

图1-9

4.时计数模块HOUR设计

模块HOUR原理图如下:

图1-10

HOUR源程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityhouris

port(reset,clk2:

instd_logic;

daout:

outstd_logic_vector(6downto0));

end;

architecturetwoofhouris

signald:

std_logic_vector(6downto0);

begin

process(clk2,reset)

begin

ifreset='1'

thend<="0000000";

elsif(clk2'eventandclk2='1')then

ifd<16#60#then

ifd="0100011"then

d<="0000000";

elsed<=d+1;

ifd(3downto0)="1001"thend<=d+7;

endif;

endif;

endif;

endif;

endprocess;

daout<=d;

end;

波形仿真如下:

图1-11

5译码模块SHUJUXUANZE设计

模块SHUJUXUANZE原理图如下:

图1-12

SHUJUXUANZE源程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityshujuxuanzeis

port(clk,reset:

instd_logic;

second,minute:

instd_logic_vector(6downto0);

hour:

instd_logic_vector(6downto0);

daout:

outstd_logic_vector(3downto0);

sel:

outstd_logic_vector(2downto0));

end;

architectureoneofshujuxuanzeis

signalq:

std_logic_vector(2downto0);

begin

process(clk,reset,second,minute,hour)

begin

ifreset='1'then

q<="000";

elsif(clk'eventandclk='1')thenq<=q+1;

endif;

endprocess;

process(q,reset)

begin

ifreset='1'then

daout<="0000";else

caseqis

when"101"=>daout<=second(3downto0);

when"100"=>daout(2downto0)<=second(6downto4);daout(3)<='0';

when"011"=>daout<=minute(3downto0);

when"010"=>daout(2downto0)<=minute(6downto4);daout(3)<='0';

when"001"=>daout<=hour(3downto0);

when"000"=>daout(2downto0)<=hour(6downto4);daout(3downto2)<="00";

whenothers=>null;

endcase;

endif;

endprocess;

sel<=q;

end;

波形仿真如下:

图1-13

6.数码显示模块SHUXIAN设计

模块SHUXIAN原理图如下:

图1-14

SHUXIAN源程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityshuxianis

port(q:

instd_logic_vector(3downto0);

sel:

instd_logic_vector(2downto0);

y:

outstd_logic_vector(6downto0));

end;

architecturert1ofshuxianis

signald:

std_logic_vector(3downto0);

begin

process(sel)

begin

caseselis

when"000"=>d<=q;

when"001"=>d<=q;

when"010"=>d<=q;

when"011"=>d<=q;

when"100"=>d<=q;

when"101"=>d<=q;

whenothers=>null;

endcase;

endprocess;

process(d)

begin

casedis

when"0000"=>y<="0111111";

when"0001"=>y<="0000110";

when"0010"=>y<="1011011";

when"0011"=>y<="1001111";

when"0100"=>y<="1100110";

when"0101"=>y<="1101101";

when"0110"=>y<="1111101";

when"0111"=>y<="0000111";

when"1000"=>y<="1111111";

when"1001"=>y<="1101111";

whenothers=>null;

endcase;

endprocess;

end;

波形仿真如下:

图1-15

7.报时模块BAOSHI设计

模块BAOSHI原理图如下:

图1-16

BAOSHI源程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitybaoshiis

port(clk:

instd_logic;

d:

instd_logic_vector(6downto0);

speak:

outstd_logic;

lamp:

outstd_logic_vector(2downto0));

end;

architecturetwoofbaoshiis

signala:

std_logic_vector(2downto0);

begin

process(clk)

begin

if(clk'eventandclk='1')then

ifd="0000000"then

a<=a+1;

caseais

when"001"=>lamp<="001";

when"010"=>lamp<="010";

when"011"=>lamp<="100";

whenothers=>lamp<="000";

endcase;

endif;

endif;

endprocess;

process(clk)

begin

if(clk'eventandclk='1')then

ifd="0000000"then

speak<='1';

elsespeak<='0';

endif;

endif;

endprocess;

end;

波形仿真如下:

图1-17

四.调试与下载

(1)在MAX+PLUSⅡ设计完成如图1-2的顶层原理图文件后,打开软件,点击“file”,选中“Project”,选择“setprojecttocurrentfile”设为工程文件,点击“MAX+PLUS”的“compiler”进行编译,编译无误后,新建“WaveformEditorfile”波形仿真文件,点击“Node”中的“EnterNodesfromSNF”,去掉“Group”前面的勾选框,点击“list”将节点添加到右侧选框中,单击“OK”完成节点的导入。

点击“MAX+PLUS”下的“Simulator”进行波形仿真;

(2)在菜单栏点击“Assign”然后选择“Device”设置硬件,在“Devicefamily”栏中选择“MAX7000S”系列,在“Device”栏中选择“EPM7128SLC84-15”型号,单击“OK”完成设定;

(3)单击“Assign”然后选择“Pin/Location/Chip”设定引脚锁定。

在“NodeName”栏输入引脚端口名,在“ChipResource”栏中选中“Pin”输入相应的引脚号。

引脚端口名和引脚号设置如下:

clk-83,reset-46,sel0-70,sel1-69,sel2-68,sethour-45,setmin-44,y0-81,

y1-80,y2-79,y3-77,y4-76.y5-75,y6-74;

(4)单击“file”,选中“project”,选择“setprojecttocurrentfile”设为工程文件,点击“MAX+PLUS”的“Compiler”进行编译,编译无误后,点击“MAX+PLUS”下的“Programmer”,点击“Program”完成程序的下载。

观察硬件开发板的运行状态,验证符合设计功能要求。

五.总结

通过本课程设计的学习,熟悉了EDA技术VHDL硬件描述语言的特点,掌握了VHDL语言编程的基本结构、语法规则以及数字电路系统设计的基本思路方法和软硬件调试与下载的方法。

掌握VHDL语言设计数字电路系统,不仅需要熟练掌握语言本身,更要有身后的电子电路基础以及其他的背景知识。

只有将VHDL语言结合到实际的领域中进行设计才能发挥它的巨大优势。

由于EDA技术是一门实践性很强的课程,从仿制、理解、实践到创新每一步都至关紧要。

同时知识是相通的,掌握控制系统的设计精髓是当务之急要提升的能力,学习了单片机原理、PLC原理、传感器原理以及本课程,实际上是给出四个方向设计实现同种功能的电路系统。

六.参考文献

1.王松武.电子创新设计与实践.北京:

国防工业出版社,2010

2.潘松.EDA技术实用教程(第三版).北京:

科学出版社,2006

3.,王诚蔡海宁等.AlteraFPGA/CPLD设计(基础篇)(第2版).北京:

人民邮电出版社.2011

4.杨旭,林盾.EDA技术基础与实验教程.北京:

清华大学出版社.2010

5.刘昌华.数字逻辑EDA设计与实践-MAX+PLUSII与QUARTUSII双剑合壁.北京:

国防工业出版社.2009

 

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

当前位置:首页 > 小学教育 > 小升初

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

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