he33504898 发表于 2013-4-9 12:45:31

请教FPGA驱动液晶屏只有黑屏

请求帮助:我写了一个简单的LCD驱动程序,根据时序来写的,但是一下载进去,屏幕就是黑色的,不论怎么修改都是这样,请问下是什么原因呢。我使用了DE模式,下面程序代码,clk是从PLL中引出的60Mhz,DCLK是像素时钟。
module de(
input clk,
   input rst_n,
   output reg red,
   output reg green,
   output reg blue,
   output regDCLK,
   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 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 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
reghdis_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模式的时序图
时序特性图
请做过的指点下,谢谢了

sme 发表于 2013-4-9 13:06:22

是不是LCD还要配置?许多LCD屏要送一些配置的命令。

he33504898 发表于 2013-4-9 16:02:12

sme 发表于 2013-4-9 13:06 static/image/common/back.gif
是不是LCD还要配置?许多LCD屏要送一些配置的命令。

这个屏不要配置吧?我看了它的手册,传上来大家给看看,出出主意

he33504898 发表于 2013-4-9 16:03:32

sme 发表于 2013-4-9 13:06 static/image/common/back.gif
是不是LCD还要配置?许多LCD屏要送一些配置的命令。

这个屏不要配置吧?我看了它的手册,传上来大家给看看,出出主意,回复重了

aureole 发表于 2013-4-9 17:12:32

背光打开了吗

he33504898 发表于 2013-4-9 17:18:36

打开了的

he33504898 发表于 2013-4-9 17:19:56

没有下载程序前打开背光了,是白色,下载程序后成了黑色,不论是写的什么颜色{:sad:}

hys0401 发表于 2013-4-9 18:44:33

本帖最后由 hys0401 于 2013-4-9 18:48 编辑

你没有给HSYNC和VSYNC信号,确实及肯定屏不会亮……

he33504898 发表于 2013-4-9 19:59:46

不是LCD有两种模式吗?在DE模式时候不需要HS,VS的吗,我还参考了其他的屏,如群创的也是分为这两种模式

hys0401 发表于 2013-4-9 20:41:40

本帖最后由 hys0401 于 2013-4-9 20:43 编辑

那可能就是别的问题了。

he33504898 发表于 2013-4-9 20:50:59

嗯 我去好好检查下

kebaojun305 发表于 2013-4-9 20:53:38

仿真下时序   这个主要还是时序。

he33504898 发表于 2013-4-9 21:15:51

就是对时序这个理解的不行,上面的那些复位都应该做相应的处理的,但是时序有点难,摸不着头绪,能不能讲一下呢?

skycomm 发表于 2013-4-10 11:02:14

看手册上有个开关
disp(31pin)确认一下是不是正确的

skycomm 发表于 2013-4-10 11:03:43

建议先试用 RGB mode 试一下 看看能不能点亮

he33504898 发表于 2013-4-10 12:31:25

正在寻找解决办法中,谢谢

lcrromi 发表于 2013-4-10 21:22:22

程序有冲突

he33504898 发表于 2013-4-17 19:55:50

本帖最后由 he33504898 于 2013-4-17 19:58 编辑

谢谢大家的帮助,这块LCD终于是被我折腾出来了,上面的程序还是有些问题,其实黑屏是因为时钟还是对了,但是没有传过去数据导致,默认为黑屏。还请大家多多指点,自学真的是很锻炼人的精神

he33504898 发表于 2013-4-17 19:57:28

本帖最后由 he33504898 于 2013-4-17 19:58 编辑

传倒了!!见谅
页: [1]
查看完整版本: 请教FPGA驱动液晶屏只有黑屏