EDA课程设计报告数字电子时钟.docx
- 文档编号:5851997
- 上传时间:2023-01-01
- 格式:DOCX
- 页数:17
- 大小:268.79KB
EDA课程设计报告数字电子时钟.docx
《EDA课程设计报告数字电子时钟.docx》由会员分享,可在线阅读,更多相关《EDA课程设计报告数字电子时钟.docx(17页珍藏版)》请在冰豆网上搜索。
EDA课程设计报告数字电子时钟
EDA课程设计报告
设计题目:
数字时钟的设计
班级:
电气工程及其自动化
姓名:
学号:
日期:
2014年6月15日
摘要
一、课程设计任务及要求3
实验目的3
二、整体设计思想4
性能指标及功能设计4
总体方框图4
控制模块的结构5
按键处理模块6
定时时钟模块6
扫描时钟模块6
定时计数模块6
显示控制模块7
四、主程序…………………………………………………………………………………………….7
五、实验步骤……………………………………………………………………………………………14
工程建立及存盘14
时序仿真14
引脚锁定14
硬件测试15
实验结果15
结束语15
参考文献16
EDA技术实现的数字电子时钟设计
作者:
指导老师:
摘要
EDA技术在硬件实现方面融合了大规模集成电路制造技术,IC版图设计技术、ASIC测试与封装技术、FPGA/CPLD编程下载技术、自动检测技术等;EDA技术为现代电子理论和设计的表达与实现提供了可能性。
在现代技术的所有领域中,纵观许多得以飞速发展的科学技术,多为计算机辅助设计,而非自动化设计。
显然,最早进入设计自动化的技术领域之一是电子技术,这就是为什么电子技术始终处于所有科学技术发展最前列的原因之一。
不难理解,EDA技术已不是某一学科的分支,或某种新的技能技术,应该是一门综合性学科。
它融合多学科于一体,打破了软件和硬件间的壁垒,是计算机的软件技术与硬件实现、设计效率和产品性能合二为一,它代表了电子设计技术合应用激活速的发展方向。
电子时钟以成为人们常生活中数字电子钟一般由振荡器,分频器,译码器,显示器等部分组成。
电子时钟的应用非常广泛,应用于人家庭或车站、剧场、办公室等公共场所,给人们的生活,学习,工作,娱乐带来极大的便利,尽管目前市场上以有现成电子时钟集成电路芯片,价格便宜这些都是数字电路中最基本的,应用最广的电路。
数字电子钟的基本逻辑功能框图如下:
它是一个将“时”,“分”,“秒”显示于人的视觉器官的计时装置。
他的计时装置的周期为24小时,显示满刻度为23时59分59秒,另外应有校时功能。
关键字:
EDA;VHDL语言;电子时钟
一、课程设计任务及要求
实验内容
选用合适的可编程逻辑器件及外围电子元器件。
设计一个数字电子钟,利用EDA软件(QUARTUSⅡ)进行编译及仿真,设计输入可采取VHDL硬件描述语言输入法和原理图输入法,并下载到EDA实验开发系统,连接外围电路,完成实际测试。
设计要求
1)用六个数码管显示时、分、秒信息
2)设置复位功能,可通过复位键将时、分、秒清零
3)具有时、分预置功能,可分别对时和分做递增设置和递减设置
二、整体设计思想
性能指标及功能设计
数字钟时常见的一种计数装置,数字钟以1Hz的频率工作。
该设计完成数字钟的运行和显示。
其主要功能有:
(1)数字钟以1Hz的频率工作,其输入频率为1MHz。
(2)数字钟显示时、分、秒信息。
这些显示信息在6个7段数码管上完成。
(3)通过按键设置时、分信息。
并且具有对数字钟的复位功能。
复位键将时、分、秒清零,并做好重新计数的准备。
按键具有预置时、分的功能。
分别对当前的时和分信息做递增设置和递减设置。
总体方框图
三、详细设计
数字时钟的结构
该数字钟的控制部分由PLD芯片完成。
该芯片的输入和输出接口由下面信号组成:
输入信号:
复位信号(reset)
时钟输入信号(clk)
小时递增信号(inc_hour)
小时递减信号(sub_hour)
分钟递增信号(inc_min)
分钟递减信号(sub_min)
输出信号:
7段数码管选信号(sel)
7段数码管段选信号(q)
控制模块结构
该设计分成下面五个模块:
定时时钟模块、扫描时钟模块、按键处理模块、定时计数模块和显示控制模块。
图给出了这几个模块之间的信号连接关系。
、按键处理模块
由于VHDL语言的规则,将按键的处理和定时模块设计在一起。
为了描述清楚,将对按键的处理进行说明。
在该设计中,采用异步复位电路方式。
当复位信号低有效时,计数器停止计数,时、分、秒清零。
对于小时的递增、递减按键操作,通过一个1Hz的计数时钟采样。
图给出了递增、递减的操作时序。
当1Hz的div_clk信号的上升沿到来时,检测hour_inc和hour_dec按键,图中的虚线表示在时钟的上升沿对按键信号进行采样。
当hour_inc或hour_dec按键低有效时,对小时进行递加或递减操作。
对于分钟的递加、递减按键操作,也是通过一个1Hz的计数时钟采样。
原理同图。
、定时时钟模块
定时时钟模块其作用就是将外部提供的1MHz的时钟,通过分频器后向模块内的定时计数模块提供1Hz的定时计数时钟。
在设计定时时钟模块时,采用同步计数电路。
、扫描时钟模块
扫描时钟模块的作用就是通过对1MHz的分频处理后,向显示控制模块提供合适的显示扫描时钟,该时钟必须经过合理的设计,才能保证7段数码显示的稳定。
在设计扫描时钟模块时,采用同步计数电路。
、定时计数模块
定时计数模块是该设计中最重要的一部分,在设计该模块时,为了便于后续显示控制模块的设计,将时、分、秒进行分离,即小时分成了小时的十位和个位分别处理,分钟分成了分钟的十位和个位分别处理。
秒分成了秒的十位和个位分别处理。
在该设计中,采用24小时计数模式。
例如:
13:
28:
57。
13为小时的表示,1为小时的十位,3为小时的个位;28为分钟的表示,2为分钟的十位,8为分钟的个位;57为秒的表示,5为秒的十位,7为秒的个位。
秒的个位计数从0-9,即十进制计数。
当秒的个位计数到9后,准备向秒的十位进位。
秒的十位计数从0-5,即六进制计数。
当秒的十位计数到5后,准备向分的个位进位。
分钟的个位计数从0-9,即十进制计数。
当分钟的个位计数到9后,准备向分钟的十位进位。
分钟的十位计数从0-5,即六进制计数。
当分钟的十位计数到5后,准备向小时的个位进位。
对于小时的处理比较复杂,小时的十位和个位之间存在下面的关系:
(1)当小时的十位为0或1时,小时的个位可以计数范围为0-9,即十进制计数;
(2)当小时的十位为2时,小时的各位可以计数的范围为0-3,即四进制计数;
、显示控制模块
显示控制模块主要作用是在7段数码管上正确的显示0-9的数字。
sel三位选择线和3-8译码器相连
四、主程序
libraryIEEE;
useclockis
port(
clk:
instd_logic;
rst:
instd_logic;
inc_min:
instd_logic;
sub_min:
instd_logic;
inc_hour:
instd_logic;
sub_hour:
instd_logic;
sel:
outstd_logic_vector(5downto0);
q:
outstd_logic_vector(7downto0));
endclock;
architectureBehavioralofclockis
signalsec_counter1:
std_logic_vector(3downto0);
signalsec_counter2:
std_logic_vector(3downto0);
signalmin_counter1:
std_logic_vector(3downto0);
signalmin_counter2:
std_logic_vector(3downto0);
signalhour_counter1:
std_logic_vector(3downto0);
signalhour_counter2:
std_logic_vector(3downto0);
signaldivcounter:
std_logic_vector(8downto0);
signaldiv_clk:
std_logic;
signalscancounter:
std_logic_vector(1downto0);
signalscan_clk:
std_logic;
signalscan_out:
std_logic_vector(2downto0);
signalsecseg1,secseg2,minseg1,minseg2,hourseg1,hourseg2:
std_logic_vector(7downto0);
begin
process(rst,clk)
begin
if(rst='1')then
divcounter<="000000000";
div_clk<='0';
elsif(rising_edge(clk))then
if(divcounter="1")then
divcounter<="000000000";
div_clk<=notdiv_clk;
else
divcounter<=divcounter+1;
endif;
endif;
endprocess;
process(rst,clk)
begin
if(rst='1')then
scancounter<="00";
scan_clk<='0';
elsif(rising_edge(clk))then
if(scancounter="11")then
scancounter<="00";
scan_clk<=notscan_clk;
else
scancounter<=scancounter+1;
endif;
endif;
endprocess;
clock:
process(div_clk,rst)
begin
if(rst='1')then
sec_counter1<=X"0";
sec_counter2<=X"0";
min_counter1<=X"0";
min_counter2<=X"0";
hour_counter1<=X"0";
hour_counter2<=X"0";
elsif(rising_edge(div_clk))then
if(inc_min='1')then
if(min_counter1=X"9")then
min_counter1<=X"0";
if(min_counter2>=X"5")then
min_counter2<=X"0";
else
min_counter2<=min_counter2+1;
endif;
else
min_counter1<=min_counter1+1;
endif;
elsif(sub_min='1')then
if(min_counter1=X"0")then
min_counter1<=X"9";
if(min_counter2=X"0")then
min_counter2<=X"5";
else
min_counter2<=min_counter2-1;
endif;
else
min_counter1<=min_counter1-1;
endif;
elsif(inc_hour='1')then
if(hour_counter2=X"2")then
if(hour_counter1=X"3")then
hour_counter1<=X"0";
hour_counter2<=X"0";
else
hour_counter1<=hour_counter1+1;
endif;
else
if(hour_counter1=X"9")then
hour_counter1<=X"0";
hour_counter2<=hour_counter2+1;
else
hour_counter1<=hour_counter1+1;
endif;
endif;
elsif(sub_hour='1')then
if(hour_counter1=X"0")then
if(hour_counter2=X"0")then
hour_counter1<=X"3";
hour_counter2<=X"2";
else
hour_counter2<=hour_counter2-1;
hour_counter1<=X"9";
endif;
else
hour_counter1<=hour_counter1-1;
endif;
else
if(sec_counter1>=X"9")then
sec_counter1<=X"0";
if(sec_counter2>=X"5")then
sec_counter2<=X"0";
if(min_counter1>=X"9")then
min_counter1<=X"0";
if(min_counter2>=X"5")then
min_counter2<=X"0";
if(hour_counter2=X"2")then
if(hour_counter1=X"3")then
hour_counter1<=X"0";
hour_counter2<=X"0";
else
hour_counter1<=hour_counter1+1;
endif;
else
if(hour_counter1=X"9")then
hour_counter1<=X"0";
hour_counter2<=hour_counter2+1;
else
hour_counter1<=hour_counter1+1;
endif;
endif;
else
min_counter2<=min_counter2+1;
endif;
else
min_counter1<=min_counter1+1;
endif;
else
sec_counter2<=sec_counter2+1;
endif;
else
sec_counter1<=sec_counter1+1;
endif;
endif;
endif;
endprocessclock;
process(rst,scan_clk)
begin
if(rst='1')then
scan_out<="000";
elsif(rising_edge(scan_clk))then
if(scan_out="101")then
scan_out<="000";
else
scan_out<=scan_out+1;
endif;
endif;
endprocess;
process(scan_out)
begin
casescan_outis
when"000"=>q<=secseg1;sel<="000001";
when"001"=>q<=secseg2;sel<="000010";
when"010"=>q<=minseg1;sel<="000100";
when"011"=>q<=minseg2;sel<="001000";
when"100"=>q<=hourseg1;sel<="010000";
when"101"=>q<=hourseg2;sel<="100000";
whenothers=>q<="";sel<="000000";
endcase;
endprocess;
second_counter1:
process(sec_counter1)
begin
casesec_counter1is
when"0000"=>secseg1<="";
when"0001"=>secseg1<="";
when"0010"=>secseg1<="";
when"0011"=>secseg1<="";
when"0100"=>secseg1<="";
when"0101"=>secseg1<="";
when"0110"=>secseg1<="";
when"0111"=>secseg1<="";
when"1000"=>secseg1<="";
when"1001"=>secseg1<="";
whenothers=>secseg1<="";
endcase;
endprocesssecond_counter1;
second_counter2:
process(sec_counter2)
begin
casesec_counter2is
when"0000"=>secseg2<="00111111";
when"0001"=>secseg2<="00000110";
when"0010"=>secseg2<="01011011";
when"0011"=>secseg2<="01001111";
when"0100"=>secseg2<="01100110";
when"0101"=>secseg2<="01101101";
whenothers=>secseg2<="01111111";
endcase;
endprocesssecond_counter2;
minute_counter1:
process(min_counter1)
begin
casemin_counter1is
when"0000"=>minseg1<="";
when"0001"=>minseg1<="";
when"0010"=>minseg1<="";
when"0011"=>minseg1<="";
when"0100"=>minseg1<="";
when"0101"=>minseg1<="";
when"0110"=>minseg1<="";
when"0111"=>minseg1<="";
when"1000"=>minseg1<="";
when"1001"=>minseg1<="";
whenothers=>minseg1<="";
endcase;
endprocessminute_counter1;
minute_counter2:
process(min_counter2)
begin
casemin_counter2is
when"0000"=>minseg2<="00111111";
when"0001"=>minseg2<="00000110";
when"0010"=>minseg2<="01011011";
when"0011"=>minseg2<="01001111";
when"0100"=>minseg2<="01100110";
when"0101"=>minseg2<="01101101";
whenothers=>minseg2<="01111111";
endcase;
endprocessminute_counter2;
process(hour_counter1)
begin
casehour_counter1is
when"0000"=>hourseg1<="";
when"0001"=>hourseg1<="";
when"0010"=>hourseg1<="";
when"0011"=>hourseg1<="";
when"0100"=>hourseg1<="";
when"0101"=>hourseg1<="";
when"0110"=>hourseg1<="";
when"0111"=>hourseg1<="";
when"1000"=>hourseg1<="";
when"1001"=>hourseg1<="";
whenothers=>hourseg1<="";
endcase;
endprocess;
hor_counter2:
process(hour_counter2)
begin
casehour_counter2is
when"0000"=>hourseg2<="00111111";
when"0001"=>hourseg2<="00000110";
when"0010"=>hourseg2<="01011011";
whenothers=>hourseg2<="01111111";
endcase;
endprocess;
endBehavioral;
五、实验步骤
工程建立及存盘
1.打开QuartusⅡ,单击“File”菜单,选择File→NewProjectWizard,对话框如下:
分别输入项目的工作路径、项目名和实体名,单击Finish。
2.单击“File”菜单,选择New,弹出小对话框,双击“VHDLFile",即选中了文本编辑方式。
在出现的“”文本编辑窗中键入VHDL程序,输入完毕后,选择File→SaveAs,即出现“SaveAs”对话框。
选择自己建立好的存放本文件的目录,然后在文件名框中键入文件名,按“Save”按钮。
3.建立工程项目,在保存VHDL文件时会弹出是否建立项目的小窗口,点击“Yes”确定。
即出现建立工程项目的导航窗口,点击“Next”,最后在出现的屏幕中分别键入新项目的工作路径、项目名和实体名。
注意,原理图输入设计方法中,存盘的原理图文件名可以是任意的,但VHDL程序文本存盘的文件名必须与文件的实体名一致,输入后,单击“Finish”按钮。
4.然后对程序进行编译
时序仿真
建立波形文件:
选择File→New,在New窗中选中“OtherFile”标签。
在出现的屏幕中选择“VectorWaveformFile”项出现一新的屏幕。
在出现的新屏幕中,双击“Name”下方的空白处,弹出“InsertNodorBus”对话框,单击该对话框的“NodeFinder…
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- EDA 课程设计 报告 数字 电子 时钟