實驗現象:
綠色led閃爍
核心原始碼:
//--------------------module_counter_ctrl--------------------// module counter_ctrl ( input clk_25m, input rst_n, output fpga_ledg ); //--------------------counter_ctrl--------------------------// /*計數器控制綠色led閃爍*/ reg [24:0]cnt; reg ledg; always@(posedge clk_25m or negedge rst_n) if(!rst_n) begin ledg <= 1'd1; cnt <= 25'd0; end else if(cnt == 25'd5000000) begin ledg <= ~ledg; cnt <= 25'd0; end else cnt <= cnt + 1'd1; assign fpga_ledg = ledg; //--------------------endmodule-----------------------------// endmodule
原始碼下載連結:
連結:http://pan.baidu.com/s/1dE1FRfb 密碼:u34v
iCore4連結: