一步一步交流讨论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; 好 坛子里有好多DIY,CPLD驱动TFT的. 方便时给个建议.谢谢. --产生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; --外部接口在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; 关注 持续关注!~ 有没有愿景深入讨论呢.(特别是对外8080接口) 持续关注!!!! 研究过一段时间,现在没有时间搞。
帮顶 回复【9楼】liuzhijun
-----------------------------------------------------------------------
我已经搞好了,好像你用的VHDL语言吧? 10楼,你实现了多少功能.
此程序了实现 8点填充.全屏硬件填充。
双缓存.13.5M无等待数据读出.
13.5M无等待数据写入。 背景色过虑。 背景色过滤是个啥东东,其他的都理解 关注 关注 看来坛里子用 EMP240 +ISSI 25616AL + 液晶屏
产品级的应用还比较少啊。大家都用 ARM9了? 经过核算成本,将SRAM改成SDRAM更合算。 谢谢分享 回复【楼主位】widesoft1
-----------------------------------------------------------------------
楼主屏哪里买的,多少钱?我也想弄一个玩玩~
谁手里有闲着的群创屏,转手给我个也行啊~ 关注一下楼主有没有将这个做成8080的驱动板呢?有的话我想购买一些 这是TFT工作在DE模式的吧? 关注 就是 自己老是不会 那位兄台创建一群,大家一起来研究这CPLD_TFT的代码。 回复【楼主位】widesoft1
-----------------------------------------------------------------------
请问楼主能否实现窗口功能? 哥们,你的代码验证了没,我想用一下 好东西,谢谢楼主 mark 请问各位高手 这句 DotCount <= (others => '0');括号里面的是什么意思?不懂这个符号 (=>)
用verilog应该怎么写啊? mark 好帖子。学习。 先MARK,等会再仔细阅读 先MARK,等会再仔细阅读 MARKCPLD 驱动TFT TFT型号不一样,底层驱动不一样的吧,手上有两个3.2寸的TFT液晶屏,就是不会写驱动啊! 能不能驱动10.4寸的屏啊 本帖最后由 wangshaosh123 于 2012-12-14 12:38 编辑
群创7寸TFT 180一个{:lol:}
attach://77225.jpg
不同尺寸的时序很相似稍微修改就能用了 mark..... 标记一下 mark下班了 widesoft1 发表于 2011-2-17 20:10
10楼,你实现了多少功能.
此程序了实现 8点填充.全屏硬件填充。
双缓存.13.5M无等待数据读出.
楼主能共享下完整的程序吗?
谢谢! mark...... LZ,加我Q1069217225,最近也是在搞毕设,基于FPGA的图像处理
页:
[1]