Board logo

标题: 谁有彩灯循环的VHDL程序 [打印本页]

作者: green_pine    时间: 2004-5-10 10:41

计数器加译码器就可以了
作者: taltyphy    时间: 2004-5-14 21:56     标题: 谁有彩灯循环的VHDL程序

是16个彩灯循环,从左到右逐亮逐灭,从右到左逐亮逐灭,全亮全灭。
如果有的话请发到aweiphysics2000@sina.com 不胜感激~~~~~[em16]
作者: taltyphy    时间: 2004-5-14 21:56

我已经编出来了,谢谢
作者: 123456    时间: 2005-6-3 23:24

可以发为我吗,谢谢拉
wetofire@163.com
作者: 恍惚之间    时间: 2005-6-27 10:57

你可不可以给我看看电路图?
作者: icesword    时间: 2005-6-27 15:15

module redlight(clk,reset,out); input clk,reset; output [16:1] out; reg [16:1] out; reg [4:1] counter; always @(posedge clk or posedge reset) if(reset) counter<=0; else begin counter=counter+1; if(counter<18) begin case (counter) 5'd0 : out<=16'h0001; 5'd1 : out<=16'h0002; 5'd2 : out<=16'h0004; 5'd3 : out<=16'h0008; 5'd4 : out<=16'h0010; 5'd5 : out<=16'h0020; 5'd6 : out<=16'h0040; 5'd7 : out<=16'h0080; 5'd8 : out<=16'h0100; 5'd9 : out<=16'h0200; 5'd10: out<=16'h0400; 5'd11: out<=16'h0800; 5'd12: out<=16'h1000; 5'd13: out<=16'h2000; 5'd14: out<=16'h4000; 5'd15: out<=16'h8000; 5'd16: out<=16'hffff; 5'd17: out<=16'h0000; default: out<=16'h0000; endcase end else counter<=5'd0; end endmodule
作者: icesword    时间: 2005-6-27 19:08

上面的只是仿真了,下面的是经过测试的。 module redlight(clk,out); input clk; output [16:1] out; reg [16:1] out; reg [5:1] counter; always @(posedge clk ) begin counter=counter+1; if(counter<18) begin case (counter) 5'd0 : out<=16'h0001; 5'd1 : out<=16'h0002; 5'd2 : out<=16'h0004; 5'd3 : out<=16'h0008; 5'd4 : out<=16'h0010; 5'd5 : out<=16'h0020; 5'd6 : out<=16'h0040; 5'd7 : out<=16'h0080; 5'd8 : out<=16'h0100; 5'd9 : out<=16'h0200; 5'd10: out<=16'h0400; 5'd11: out<=16'h0800; 5'd12: out<=16'h1000; 5'd13: out<=16'h2000; 5'd14: out<=16'h4000; 5'd15: out<=16'h8000; 5'd16: out<=16'hffff; 5'd17: out<=16'h0000; default: out<=16'h0000; endcase end else counter<=5'd0; end endmodule
作者: zhiyuh    时间: 2005-6-27 20:41

这个是VHDL吗?我怎么看怎么象Verilog呢
作者: icesword    时间: 2005-6-28 20:49

是VERILOG HDL,因为本人擅长VERILOG HDL就用它编了,哈哈。
作者: flydream01    时间: 2005-9-5 17:40

呵呵,谢谢斑竹,我也有用
作者: dingyanloveai    时间: 2011-2-16 22:59

斑竹  咱们交流下行吗???  我也是做这个的 我qq   779537131




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0