|
我听别人建议修改一下,我想用两个并联74hc595控制数码管静态输出 电路图在最下面,
module led(clk,sw_ret,dsrt,dain,dclk,dlk);
input clk; //时钟
input sw_ret; //按键输入复位信号控制drst输出复位(可以先不要)
output reg dsrt; //输出复位信号到595
output reg dain; //数据输出带595
output reg dclk; //移位信号输出到595
output reg dlk; //锁存输出到595
我思路是将16个数据信号(包括头四位不相关数据,中间四位位选,最后八位段选)先移位到两个74hc595,然后锁存一次输出,轮流选中4个数码管,我设置了两个标志变量为 ready (16位数据最高位已经移近dain信号输出端)和 busy (数据正在传送)来防止传输数据被覆盖,可是就是不行,已经确定不是硬件问题,例程可以显示。。。
再次求会的朋友给个思路,或者问题可能所在,求求大家。。。fpga我刚到手两天。。。所以可以的话最好说明清楚一下。。。谢谢。。谢谢。。
下面是之前的贴,可以跳过去看下面电路。。谢谢
我刚学几天fpga,对verilog不熟,可是又要赶着要用。。昨天一整天都在弄这个现实,就是不行。。警告也很多。。写进去数码管一个不亮,麻烦会的大哥大姐帮帮忙啊,我后天就要用这个。。T T 程序如下,还有电路图。。。写的有些乱。。
还有有这个编程什么技巧啊?并行执行实在是不适应。。我见他们历程都用了很多标志变量进行判断,我就是不知道怎么用。。想谢谢帮忙,谢谢。。
`timescale 1ns / 1ps
module led(clk,sw_ret,dsrt,dain,dclk,dlk);
input clk;
input sw_ret;
output reg dsrt;
output reg dain;
output reg dclk;
output reg dlk;
reg [7:0] tim/*,duan*/,wei;
reg [15:0] data_in,data_buf1;
reg flag1,flag2=0;
// reg [3:0] num;
reg [5:0] cou;
parameter
d0= 8'b1100_0000,
d1= 8'b1111_1001,
d2= 8'b1010_0100,
d3= 8'b1011_0000,
w0=8'b1111_0001,
w1=8'b1111_0010,
w2=8'b1111_0100,
w3=8'b1111_1000;
initial data_in=16'h0123;
always@(posedge clk)
begin
if(!sw_ret) dsrt<=0;
else tim<=tim+1'b1;
end
always@(posedge clk)
begin
if(!flag1) begin flag1<=1;data_buf1<=data_in;end
else
begin
if(!flag2)
begin
dlk<=0;
case(tim[7:6])
00:begin wei<=w0;/*num<=data_buf1[3:0];*/end
01:begin wei<=w1;/*num<=data_buf1[7:4];*/end
10:begin wei<=w2;/*num<=data_buf1[11:8];*/end
11:begin wei<=w3;/*num<=data_buf1[15:12];*/end
endcase
/* case(num)
0:begin duan<=d0;end
1:begin duan<=d1;end
2:begin duan<=d2;end
3:begin duan<=d3;end
endcase */
data_buf1<={wei,8'h00};
if(data_buf1)
begin dain<=data_buf1[15];data_buf1<=data_buf1<<1;end
else flag2<=1;
end
else
begin
if(((tim>8'h02)&&(tim<8'h22))||((tim>8'h42)&&(tim<8'h62))||((tim>8'h82)&&(tim<8'ha2))||((tim>8'hc2)&&(tim<8'he2)))
begin dclk<=~dclk;cou<=cou+1; end
else if(cou>32) begin cou<=0;flag2<=0;dlk<=1;end
end
end
end
endmodule
下面程序警告,说有很多固定值,不知道有没有影响:
WARNING:Xst:653 - Signal <data_in> is used but never assigned. This sourceless signal will be automatically connected to value 0000000100100011.
WARNING:Xst:1710 - FF/Latch <data_buf1_0> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_1> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_2> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_3> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_4> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_5> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_6> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_7> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <wei_2> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <wei_3> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1710 - FF/Latch <data_buf1_0> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_1> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_2> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_3> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_4> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_5> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_6> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <data_buf1_7> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <wei_2> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <wei_3> (without init value) has a constant value of 0 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1710 - FF/Latch <wei_4> (without init value) has a constant value of 1 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <wei_5> (without init value) has a constant value of 1 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <wei_6> (without init value) has a constant value of 1 in block <led>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <wei_7> (without init value) has a constant value of 1 in block <led>. This FF/Latch will be trimmed during the optimization process.
电路图 (原文件名:54fbb2fbc99cdb6f4f4aeabc.jpg)
谢谢,谢谢。。。 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|