数字电路课程设计报告数字钟设计.docx
- 文档编号:1877969
- 上传时间:2022-10-24
- 格式:DOCX
- 页数:16
- 大小:78.70KB
数字电路课程设计报告数字钟设计.docx
《数字电路课程设计报告数字钟设计.docx》由会员分享,可在线阅读,更多相关《数字电路课程设计报告数字钟设计.docx(16页珍藏版)》请在冰豆网上搜索。
数字电路课程设计报告数字钟设计
题目:
数字钟设计
1设计要求
1、设计一个数字钟,能够显示当前时间,分别用6个数码管显示小时、分钟、秒钟的时间,秒针的计数频率为1Hz,可由系统脉冲分频得到。
2、在整点进行提示,可通过LED闪烁实现,闪烁频率及花型可自己设计。
3、能够调整小时和分钟的时间,调整的形式为通过按键进行累加。
4、具有闹钟功能,闹钟时间可以任意设定(设定的形式同样为通过按键累加),并且在设定的时间能够进行提示,提示同样可以由LED闪烁实现。
2设计分析及系统方案设计
采用7个七段译码管,前6个显示时间,最后一个显示模式,通过模式0~4来实现正常计时,调时,调闹钟的功能作为控制模块。
系统可分为分频模块,计时模块,译码管显示模块,控制模块,报警控制模块,以及警报花型模块。
结果框图如下:
3系统以及模块硬件电路设计
NodeName
Location
NodeName
Location
NodeName
Location
clk
PIN_N2
hex4[1]
PIN_U1
hex7[3]
PIN_Y22
hex1[0]
PIN_L3
hex4[2]
PIN_U2
hex7[2]
PIN_W21
hex1[1]
PIN_L2
hex4[3]
PIN_T4
hex7[1]
PIN_V21
hex1[2]
PIN_L9
hex4[4]
PIN_R7
hex7[0]
PIN_V20
hex1[3]
PIN_L6
hex4[5]
PIN_R6
hex8[0]
PIN_AF10
hex1[4]
PIN_L7
hex4[6]
PIN_T3
hex8[1]
PIN_AB12
hex1[5]
PIN_P9
hex5[0]
PIN_Y23
hex8[2]
PIN_AC12
hex1[6]
PIN_N9
hex5[1]
PIN_AA25
hex8[3]
PIN_AD11
hex2[0]
PIN_R2
hex5[2]
PIN_AA26
hex8[4]
PIN_AE11
hex2[1]
PIN_P4
hex5[3]
PIN_Y26
hex8[5]
PIN_V14
hex2[2]
PIN_P3
hex5[4]
PIN_Y25
hex8[6]
PIN_V13
hex2[3]
PIN_M2
hex5[5]
PIN_U22
key2
PIN_P23
hex2[4]
PIN_M3
hex5[6]
PIN_W24
key3
PIN_W26
hex2[5]
PIN_M5
hex6[0]
PIN_AB23
pause
PIN_V2
hex2[6]
PIN_M4
hex6[1]
PIN_V22
reset
PIN_V1
hex3[0]
PIN_T2
hex6[2]
PIN_AC25
tip[3]
PIN_U18
hex3[1]
PIN_P6
hex6[3]
PIN_AC26
tip[2]
PIN_U17
hex3[2]
PIN_P7
hex6[4]
PIN_AB26
tip[1]
PIN_AA20
hex3[3]
PIN_T9
hex6[5]
PIN_AB25
tip[0]
PIN_Y18
hex3[4]
PIN_R5
hex6[6]
PIN_Y24
key1
PIN_N23
hex3[5]
PIN_R4
hex7[6]
PIN_AB24
hex3[6]
PIN_R3
hex7[5]
PIN_AA23
hex4[0]
PIN_U9
hex7[4]
PIN_AA24
4系统的VerilogHDL设计
moduleclock(hex8,hex7,hex6,hex5,hex4,hex3,hex2,hex1,reset,clk,pause,tip,key3,key2);
output[6:
0]hex8;
output[6:
0]hex7;
output[6:
0]hex6;
output[6:
0]hex5;
output[6:
0]hex4;
output[6:
0]hex3;
output[6:
0]hex2;
output[6:
0]hex1;
output[3:
0]tip;
inputkey3,key2;//key3调节模式,key2用来控制调节的量
inputreset;
inputclk;
inputpause;//当pause=1时停止计数(数字钟暂停)
wirem_p,h_p;//进位或调时时产生上升沿,分别控制分钟和时钟的增加
reg[3:
0]tip;//报警时的led
reg[6:
0]hex8;
reg[6:
0]hex7;
reg[6:
0]hex6;
reg[6:
0]hex5;
reg[6:
0]hex4;
reg[6:
0]hex3;
reg[6:
0]hex2;
reg[6:
0]hex1;
reg[2:
0]qout8;//表示模式
reg[3:
0]qout7;
reg[3:
0]qout6;//qout1至qout6为时钟显示时间
reg[3:
0]qout5;
reg[3:
0]qout4;
reg[3:
0]qout3;
reg[3:
0]qout2;
reg[3:
0]qout1;
regrco4;
regrco2;
regrcoc;
regclka;
regctr;
regalert1,alert2;
reg[2:
0]mode;
reg[24:
0]temp;
reg[23:
0]temp1;
reg[9:
0]temp2;
reg[7:
0]second;
reg[7:
0]min;//闹钟时间
reg[7:
0]minute;//实际时间
reg[7:
0]h;//闹钟时间
reg[7:
0]hour;//实际时间
assignm_p=rco4||!
key2;
assignh_p=rco2||!
key2;
always@(posedgeclk)//分频得到1Hz频率
begin
if(temp==24999999)
begin
temp<=0;
clka=!
clka;
end
else
temp<=temp+1;
hex7<=7'b1111111;
end
always@(posedgeclk)//得到4Hz频率
begin
if(temp1==3124999)
begin
temp1<=0;
ctr=!
ctr;
end
else
temp1<=temp1+1;
end
always@(posedgekey3)//mode=3'b010时调节时钟,3'b001时调节分钟,3'b011时调节闹钟时钟,3'b100时设置闹钟时钟,通过hex8显示
begin
if(mode==3'b100)
mode<=3'b000;
else
mode<=mode+1'b1;
qout8<=mode;
end
always@(posedgeclkaorposedgereset)//秒
begin
if(reset==1)
second<=4'b0000;
elseif(pause==1)
second<=second;
elseif(second==59)
begin
second<=4'b0000;
rco4<=1'b1;
end
else
begin
second<=second+1;
rco4<=1'b0;
end
qout5<=second/10;
qout6<=second%10;
end
/*7段译码管时间显示模块*/
always@(qout8)//显示mode
begin
case(qout8)
3'b100:
hex8<=7'b1000000;
3'b000:
hex8<=7'b1111001;
3'b001:
hex8<=7'b0100100;
3'b010:
hex8<=7'b0110000;
3'b011:
hex8<=7'b0011001;
default:
hex8<=7'b1111111;
endcase
end
always@(qout6)
begin
case(qout6)
4'b0000:
hex6<=7'b1000000;
4'b0001:
hex6<=7'b1111001;
4'b0010:
hex6<=7'b0100100;
4'b0011:
hex6<=7'b0110000;
4'b0100:
hex6<=7'b0011001;
4'b0101:
hex6<=7'b0010010;
4'b0110:
hex6<=7'b0000011;
4'b0111:
hex6<=7'b1111000;
4'b1000:
hex6<=7'b0000000;
4'b1001:
hex6<=7'b0011000;
default:
hex6<=7'b1000000;
endcase
end
always@(qout5)
begin
case(qout5)
4'b0000:
hex5<=7'b1000000;
4'b0001:
hex5<=7'b1111001;
4'b0010:
hex5<=7'b0100100;
4'b0011:
hex5<=7'b0110000;
4'b0100:
hex5<=7'b0011001;
4'b0101:
hex5<=7'b0010010;
4'b0110:
hex5<=7'b0000011;
default:
hex5<=7'b1000000;
endcase
end
always@(qout4)
begin
case(qout4)
4'b0000:
hex4<=7'b1000000;
4'b0001:
hex4<=7'b1111001;
4'b0010:
hex4<=7'b0100100;
4'b0011:
hex4<=7'b0110000;
4'b0100:
hex4<=7'b0011001;
4'b0101:
hex4<=7'b0010010;
4'b0110:
hex4<=7'b0000011;
4'b0111:
hex4<=7'b1111000;
4'b1000:
hex4<=7'b0000000;
4'b1001:
hex4<=7'b0011000;
default:
hex4<=7'b1000000;
endcase
end
always@(qout3)
begin
case(qout3)
4'b0000:
hex3<=7'b1000000;
4'b0001:
hex3<=7'b1111001
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数字电路 课程设计 报告 数字 设计