widesoft1 发表于 2011-1-26 22:26:48

一步一步交流讨论CPLD驱动TFT(以群创AT043TN24为例)

主要硬件54M晶振    EMP240 +ISSI 25616AL + 液晶屏
如何最简便可靠的输出9M点时钟供给液晶屏.
本人使用方法如下,欢迎拍砖.
--1.将54M主时钟6分频,产生9M时钟并输出至液晶屏引脚Pclk。
--2.输出DotClkEn为9M信号同步其他进程.高电平为1个主时钟周期,低电平5个主时钟周期。
--3.技巧: 001,010,011,100,101,110.共6个状态,高位刚好是6分频等宽。
--- SysRst 是全局复位引脚.Clk54是54M时钟输入.
--ClkCnt_3是3位分频用计数器.
    process (Clk54,SysRst)
    begin
      if SysRst = '0' then
            ClkCnt_3 <= "001";
            Pclk <= '0';
            DotClkEn <= '0';
      elsif (Clk54'event and Clk54 = '1') then
            if (ClkCnt_3(2) and ClkCnt_3(1)) = '1' then --到达状态11X时 重新计数
                ClkCnt_3 <= "001";
            else
                ClkCnt_3 <= ClkCnt_3 + 1;
            end if;
            Pclk <= ClkCnt_3(2);
            DotClkEn <= ((not ClkCnt_3(2)) and ClkCnt_3(1) and ClkCnt_3(0));
      end if;
    end process;

eworker 发表于 2011-1-26 22:29:17

widesoft1 发表于 2011-1-27 09:02:20

坛子里有好多DIY,CPLD驱动TFT的. 方便时给个建议.谢谢.

widesoft1 发表于 2011-2-14 20:40:32

--产生TFT行同步
    process (Clk54,SysRst)
      variable DsMark : std_logic;
    begin
      if SysRst = '0' then
            DotCount <= (others => '0');
            DsState <= "00";
      elsif (Clk54'event and Clk54 = '1') then
            if DotClkEn = '1' then
                case DsState is
                when "00" =>--41 相当于<= 40
                  DsMark := DotCount(5) and DotCount(3);
                when "01" =>--2 相当于<= 1
                  DsMark := DotCount(0);
                when "10" =>--480 相当于<= 479
                  DsMark := DotCount(0) and DotCount(1) and DotCount(2) and DotCount(3) and
                              DotCount(4) and DotCount(6) and DotCount(7) and DotCount(8);
                when "11" =>--2 相当于<= 1
                  DsMark := DotCount(0);
                end case;
                if DsMark = '1' then
                  DotCount <= (others => '0');
                  DsState <= DsState + 1;
                else
                  DotCount <= DotCount + 1;
                end if;
            end if;
      end if;
    end process;
--产生TFT帧同步信号
    process (Clk54,SysRst)
    begin
      if SysRst = '0' then
            DE<= '0';
            VSync <= '0';
      elsif (Clk54'event and Clk54 = '1') then
            DE <=(HsState(1) and not HsState(0)) and (DsState(1) and (not DsState(0)));
            if (HsState(0) or HsState(1)) = '1' then
                VSync <= '1';
            else
                VSync <= '0';
         end if;
      end if;
    end process;
--产生帧同步时钟
    process (Clk54,SysRst)
      variable HsMark : std_logic;
    begin
      if SysRst = '0' then
            HsCount <= (others => '0');
            HsState <= (others => '0');
            FillHead <= '0';
            SelDispRam <= '0';
      elsif (Clk54'event and Clk54 = '1') then
            if (DsState(0) andDsState(1) and DotCount(0) and DotClkEn) = '1' then
                case HsState is
                when "00" =>--10相当于<= 9
                  HsMark := HsCount(0) and HsCount(3);
                when "01" =>--2相当于<= 1
                  HsMark := HsCount(0);
                when "10" =>--272相当于<= 271
                  HsMark := HsCount(0) and HsCount(1)and HsCount(2)and HsCount(3) and HsCount(8);
                when "11" =>--2相当于<= 1
                  FillHead <= RegAddr(2) and RegAddr(1) and RegAddr(0) and WrEn;
                  SelDispRam <= SysCmdValue(10);
                  HsMark := HsCount(0);
                end case;
                if HsMark = '1' then
                  HsState <= HsState + 1;
                  HsCount <= (others => '0');
                else
                  HsCount <= HsCount + 1;
                end if;
            end if;
      end if;
    end process;

widesoft1 发表于 2011-2-14 21:02:13

--外部接口在RD及CS低电平期间输出内部数据
--RS为0时输出忙信号.RS为1时输出当前地址的内部数据
    process (SysRst,ExBusOut,Busy,ExCs,ExRs,ExWr,ExRd)
      variable ExConVar : std_logic_vector(3 downto 0);
    begin
      if SysRst = '0' then
            ExDataBus <= (others => 'Z');
      else
            ExConVar := ExRs & ExCs & ExWr & ExRd;
            if ((not ExConVar(2)) and ExConVar(1) and (not ExConVar(0))) = '1' then
                if ExConVar(3) = '0' then
                                        ExDataBus <= ExBusOut(15 downto 1) & Busy;
                else
                                        ExDataBus <= ExBusOut;
                                end if;
            else
                ExDataBus <= (others => 'Z');
            end if;
      end if;
    end process;

--外部异步WR上升沿写入数据.
--RS = 0,写寄存器号.
--RS = 1,写TFT驱动板上的SRAM.
--ExWrClk_Q,相当于1位地址,每写1次加1.主时钟检测此地址
    process (ExWr,SysRst)
    begin
      if SysRst = '0' then
            WriteRgb <= (others => '0');
            ExWrClk_Q <= '1';
            RegAddr <= (others => '0');            
         elsif (ExWr'event and ExWr = '1') then
            if ExCs = '0' then
                if ExRs = '0' then
                  RegAddr(2 downto 0) <= ExDataBus(2 downto 0);
                else
                  WriteRgb <= ExDataBus;
                  ExWrClk_Q <= not ExWrClk_Q;               
                end if;
            end if;
      end if;
    end process;

--外部异步RD下降沿锁存ExRs,ExCs
    process (ExRd,SysRst)
    begin
      if SysRst = '0' then
            ExRsR_Q <= '0';
            ExCsR_Q <= '1';
      elsif (ExRd'event and ExRd = '0') then
            ExRsR_Q <= ExRs;
            ExCsR_Q <= ExCs;
      end if;
    end process;
--外部异步RD上升沿检测是否是本设备的读请求信号CS.
--ExRdClk_Q,相当于1位地址,每读1次加1.主时钟检测此地址
    process (ExRd,SysRst)
    begin
      if SysRst = '0' then
            ExRdClk_Q <= '1';
      elsif (ExRd'event and ExRd = '1') then
            if((not ExCsR_Q) and ExRsR_Q) = '1' then
                ExRdClk_Q <= not ExRdClk_Q;
            end if;
      end if;
    end process;

yuphone 发表于 2011-2-15 00:00:04

关注

ljt8015 发表于 2011-2-15 08:48:09

持续关注!~

widesoft1 发表于 2011-2-15 12:26:36

有没有愿景深入讨论呢.(特别是对外8080接口)

uplinux 发表于 2011-2-15 18:06:59

持续关注!!!!

liuzhijun 发表于 2011-2-15 18:16:42

研究过一段时间,现在没有时间搞。
帮顶

geluyong 发表于 2011-2-16 10:32:52

回复【9楼】liuzhijun
-----------------------------------------------------------------------

我已经搞好了,好像你用的VHDL语言吧?

widesoft1 发表于 2011-2-17 20:10:30

10楼,你实现了多少功能.
   此程序了实现 8点填充.全屏硬件填充。
   双缓存.13.5M无等待数据读出.
   13.5M无等待数据写入。

widesoft1 发表于 2011-2-17 20:11:09

背景色过虑。

hscheng 发表于 2011-2-25 17:01:09

背景色过滤是个啥东东,其他的都理解

above2009 发表于 2011-2-26 10:20:02

关注

hubeilcsun3 发表于 2011-2-26 10:27:01

关注

widesoft1 发表于 2011-3-5 14:44:17

看来坛里子用 EMP240 +ISSI 25616AL + 液晶屏
   产品级的应用还比较少啊。大家都用 ARM9了?

widesoft1 发表于 2011-3-8 17:53:08

经过核算成本,将SRAM改成SDRAM更合算。

2006lc 发表于 2011-3-8 21:39:06

谢谢分享

lanseiboy 发表于 2011-3-15 22:19:10

回复【楼主位】widesoft1
-----------------------------------------------------------------------

楼主屏哪里买的,多少钱?我也想弄一个玩玩~
谁手里有闲着的群创屏,转手给我个也行啊~

yiming988 发表于 2011-6-2 14:31:46

关注一下楼主有没有将这个做成8080的驱动板呢?有的话我想购买一些

niba 发表于 2011-6-3 10:27:01

这是TFT工作在DE模式的吧?

hzp080401234 发表于 2011-6-10 08:35:43

关注    就是 自己老是不会

niba 发表于 2011-6-10 13:50:23

那位兄台创建一群,大家一起来研究这CPLD_TFT的代码。

jlfeieee 发表于 2011-7-15 11:34:03

回复【楼主位】widesoft1
-----------------------------------------------------------------------

请问楼主能否实现窗口功能?

dyggyd 发表于 2011-10-26 22:29:04

哥们,你的代码验证了没,我想用一下

weather211 发表于 2011-11-8 10:47:32

好东西,谢谢楼主

lqsoft 发表于 2011-12-17 07:33:33

mark

colinin 发表于 2011-12-18 19:45:13

请问各位高手 这句 DotCount <= (others => '0');括号里面的是什么意思?不懂这个符号 (=>)
用verilog应该怎么写啊?

sain_gl 发表于 2011-12-22 20:54:40

mark

lkl10800139 发表于 2012-3-31 01:38:52

好帖子。学习。

xingchen 发表于 2012-4-26 16:24:07

先MARK,等会再仔细阅读

soulcoffee 发表于 2012-5-15 12:57:30

先MARK,等会再仔细阅读

ericl_Q 发表于 2012-9-29 17:11:36

MARKCPLD 驱动TFT

西城岛 发表于 2012-9-29 23:37:25

TFT型号不一样,底层驱动不一样的吧,手上有两个3.2寸的TFT液晶屏,就是不会写驱动啊!

lgg88 发表于 2012-12-13 22:23:43

能不能驱动10.4寸的屏啊

wangshaosh123 发表于 2012-12-14 10:24:27

本帖最后由 wangshaosh123 于 2012-12-14 12:38 编辑

群创7寸TFT 180一个{:lol:}
attach://77225.jpg

不同尺寸的时序很相似稍微修改就能用了

jordonwu 发表于 2012-12-14 11:12:06

mark.....   

pj_johnny 发表于 2012-12-15 18:31:46

标记一下

lsw0136 发表于 2014-2-11 16:22:10

mark下班了

sblpp 发表于 2014-2-19 13:50:14

widesoft1 发表于 2011-2-17 20:10
10楼,你实现了多少功能.
   此程序了实现 8点填充.全屏硬件填充。
   双缓存.13.5M无等待数据读出.


楼主能共享下完整的程序吗?
谢谢!

机器人天空 发表于 2014-3-18 15:08:51

mark......

MamBa_24 发表于 2014-3-28 17:24:42

LZ,加我Q1069217225,最近也是在搞毕设,基于FPGA的图像处理
页: [1]
查看完整版本: 一步一步交流讨论CPLD驱动TFT(以群创AT043TN24为例)