FPGAのLED制御プログラムを深く理解する(ソースコード)(3/4 ページ)

» 2016年09月09日 10時00分 公開
[PR/MONOist]
PR

List3

List 3:
module LED_Flash2(
	//Clock from oscillator
	input Clock,
	//Arduino I/Os
	inout Arduino_IO13
);
	reg[25:0] div_cntr;
	reg dec_cntr;
	initial begin
		div_cntr = 0;
		dec_cntr = 0;
		end
		
	
	always@(posedge Clock) begin
		div_cntr <= div_cntr + 1;
		if (div_cntr == 50000000) begin
			dec_cntr <= !dec_cntr;
			div_cntr <= 0;
		end	
	end
	
	assign Arduino_IO13 = dec_cntr ;
endmodule
List3

Copyright © ITmedia, Inc. All Rights Reserved.


提供:日本アルテラ株式会社
アイティメディア営業企画/制作:MONOist 編集部/掲載内容有効期限:2016年10月10日