
9、数码管、按键、分频综合实验:数字时钟
分频、按键防抖、数码管显示的综合实验。
功能:
按键S1、S2分别对时进行加1、减1操作;S3、S4分别对分进行加10、加1操作;S5、S6分别对秒进行加10、加1操作。
数字时钟分为:
1、分频模块:对50MHZ时钟进行分频,得到1HZ的时钟信号,给计数器提供使能信号。
2、counter_60:模为60的计数器,使能信号一次上升沿计数一次(使能信号需要滤波),计数60次进位。
3、counter_24:counter_60的进位信号的上升沿使能技术一次(也需要滤波)。
4、按键模块:主要是防抖和改变计数器的计数(避免信号竞争没有选择驱动使能信号,而是内部直接对寄存器改变)。
国庆前就更新到这了,视频老王还没上传,下午就出门了,所以估计是上传不了。大家先看图片吧
TOP层源码
module countdown(clk,rst_n,key_in,ledout,disp_reg,disp_bit);
input clk;
input rst_n;
input [5:0] key_in;
output ledout;
output [7:0] disp_reg;
output [7:0] disp_bit;
wire clk_en;
Div_50M CLK_DIV
(
.clk(clk),
.rst(rst_n),
.clk_out(clk_en)
);
wire [3:0] S_H;
wire [3:0] S_L;
wire SecCout;
counter60 Sec_COUNT60
(
.en(clk_en),
.clk(clk),
.rst(rst_n),
.key1(key_in[0]),
.key2(key_in[1]),
.cout(SecCout),
.HighOut(S_H),
.LowOut(S_L)
);
wire [3:0] M_H;
wire [3:0] M_L;
wire MinCout;
counter60 Min_COUNT60
(
.en(SecCout),
.clk(clk),
.rst(rst_n),
.key1(key_in[2]),
.key2(key_in[3]),
.cout(MinCout),
.HighOut(M_H),
.LowOut(M_L)
);
wire [3:0] H_H;
wire [3:0] H_L;
counter24 Hou_COUNT24
(
.en(MinCout),
.clk(clk),
.rst(rst_n),
.key1(key_in[4]),
.key2(key_in[5]),
.cout(ledout),
.HighOut(H_H),
.LowOut(H_L)
);
scan_display DISP
(
.clk(clk),
.rst_n(rst_n),
.disp_1th(S_L),
.disp_2th(S_H),
.disp_3th(M_L),
.disp_4th(M_H),
.disp_5th(H_L),
.disp_6th(H_H),
.disp_reg(disp_reg),
.dis_bit(disp_bit)
);
endmodule
可执行文件:下载
——回复可见内容——






回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
基于MSPM0L1306的MODBUS-RTU协议通讯实验被打赏50分 | |
每周了解几个硬件知识+485硬件知识分享被打赏10分 | |
【换取手持示波器】树莓派PICOW网页烟花被打赏18分 | |
【换取手持示波器】树莓派PICO逻辑分析仪被打赏16分 | |
【分享评测,赢取加热台】教你五分钟本地部署蒸馏版本的DeepSeekR1-7B被打赏12分 | |
【换取手持示波器】蓝牙音箱更换电池被打赏8分 | |
【换取手持示波器】鼠标更换微动开关被打赏10分 | |
【我要开发板】4.传感器移植被打赏50分 | |
【换取手持数字示波器】RISC-VGCC使用-fno-omit-frame-pointer编译选项实现栈回溯被打赏29分 | |
【分享评测,赢取加热台】+开关电源简述被打赏7分 |