module LED3(clk,rst_n,LED);
//programmed by haohaolinux
input clk,rst_n;
output [7:0] LED;
reg [7:0] LED;
reg [23:0] cnt;
//24 bit counter
always@(posedge clk or negedge rst_n)
if(!rst_n)
cnt <= 24'h0;
else if(cnt == 24'hffffff)
cnt <= 24'h0;
else
cnt <= cnt+1;
always@(posedge clk or negedge rst_n)
if(!rst_n)
LED <= 8'hff;
else if(cnt == 24'hffffff)
begin
LED <= {LED[6:0],~LED[7]};
if(LED == 8'h00)
LED <= 8'hff;
end
else
LED <= LED;
endmodule
有奖活动 | |
---|---|
【有奖活动——B站互动赢积分】活动开启啦! | |
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |