请求帮助:我写了一个简单的LCD驱动程序,根据时序来写的,但是一下载进去,屏幕就是黑色的,不论怎么修改都是这样,请问下是什么原因呢。我使用了DE模式,下面程序代码,clk是从PLL中引出的60Mhz,DCLK是像素时钟。
module de(
input clk,
input rst_n,
output reg[7:0] red,
output reg[7:0] green,
output reg[7:0] blue,
output reg DCLK,
output DE
);
//DCLK produce pll 1/2 div frequent clk 60M,DCLK 30M
always@(posedge clk or negedge rst_n)
begin
if(!rst_n) DCLK <= 1'd0;
else DCLK <= ~DCLK;
end
//H cnt
reg[9:0] cnt_h;
always@(negedge DCLK or negedge rst_n) //DCLK negedge locked data
begin
if(!rst_n) cnt_h <=10'd0;
else if(cnt_h < 10'd928) cnt_h<=cnt_h+1'd1;
else cnt_h <= 10'd0;
end
//DE_h
wire DE_h;
assign DE_h=(cnt_h<10'd128)?1'd0:1'd1;
//V cnt
reg[9:0] cnt_v;
always@(negedge DE_h or negedge rst_n)
begin
if(!rst_n) cnt_v <= 10'd0;
else if(cnt_v < 10'd525) cnt_v <=cnt_v+1'd1;
else cnt_v <= 10'd0;
end
//DE_v
wire DE_v;
assign DE_v=(cnt_v<10'd45)?1'd0:1'd1;
//DE produce
assign DE=DE_h&&DE_v;
//DISP area div xdis_cnt
reg[9:0]hdis_cnt;
always@(negedge DCLK or negedge rst_n)
begin
if(!rst_n) hdis_cnt<=10'd0;
else if(DE_h)hdis_cnt<=hdis_cnt+1'd1;
else
hdis_cnt<=10'd0;
end
always@(negedge DCLK or negedge rst_n)
begin
if(!rst_n)
begin
red<=8'b0000_0000;
green<=8'b0000_0000;
blue<=8'b0000_0000;
end
else if((hdis_cnt<200)&&DE)
begin
red<=8'b1111_1111;
green<=8'b0000_0000;
blue<=8'b0000_0000;
end
else if((hdis_cnt<400)&&DE)
begin
red<=8'b0000_0000;
green<=8'b1111_1111;
blue<=8'b0000_0000;
end
else if((hdis_cnt<600)&&DE)
begin
red<=8'b0000_0000;
green<=8'b0000_0000;
blue<=8'b1111_1111;
end
else if((hdis_cnt<800)&&DE)
begin
red<=8'b0000_0000;
green<=8'b0000_0000;
blue<=8'b1111_1111;
end
else
begin
red<=8'b0000_0000;
green<=8'b0000_0000;
blue<=8'b0000_0000;
end
end
endmodule
LCD的DE模式的时序图
时序特性图
请做过的指点下,谢谢了