在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 4817|回复: 1

[求助] FPGA VGA显示问题。。。。。。

[复制链接]
发表于 2013-7-16 23:47:42 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
我的程序下进去后街上VGA接口,显示器没有任何反应。。。
我的显示器是三星的LED 显示器,是不是显示器的问题???但是我的显示器打CF游戏时有VGA显示的啊、、、

代码是21EDA的代码。。。应该没问题的。。。。各位大哥大姐  帮帮忙。。。。


代码如下:
--www.21eda.com
--深圳市21EDA电子
--学习LCD VGA显示原理
--在LCD上面显示 21EDA-电子
--视频教程适合我们21EDA电子的所有学习板
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;


entity VGA_Module is
    Port ( clk50_in : in std_logic;
           Red_out : out std_logic;
           Green_out : out std_logic;
           Blue_out : out std_logic;
           hs_out : out std_logic;
           vs_out : out std_logic);
end VGA_Module;

architecture Behavioral of VGA_Module is
  signal Clk25     : std_logic;
  signal Horizontal_Counter : std_logic_vector (9 downto 0);
  signal Vertical_Counter  : std_logic_vector (9 downto 0);

begin
--Generate 25Mhz Clock
process (clk50_in)
begin
if clk50_in'event and clk50_in='1' then
   if (Clk25 = '0')then
     Clk25 <= '1' after 2 ns;
   else
     Clk25 <= '0' after 2 ns;
  end if;
end if;
end process;     

process (Clk25)
TYPE Screen_Line1 is ARRAY(0 to 15, 0 to 99) OF std_logic;
              


CONSTANT char_L1 : Screen_Line1 :=(
--///////////////Line 1/////////////////////////////////////////
('0','1','1','1','1','1','1','1','1','1','1','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','1','1','1','1','1','1','1','1','0','0',
'0','1','1','1','1','1','0','0','0','0','0','0',
'0','0','0','0','0','1','1','0','0','0','0','0',
'0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'),
--////////////////Line 2////////////////////////////////////////////
('1','0','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','1','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','1','0','0','0','0','0',
'0','0','0','0','1','0','0','1','0','0','0','0',
'0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0','0','0','0','0',
'0','0','1','1','1','1','1','1','1','1','1','1','0','0','0','0'),
--////////////////Line 3 ///////////////////////////////////////////////
('0','0','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','1','0','0','0','0',
'0','0','0','1','0','0','0','0','1','0','0','0',
'0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','1','0','0','0','0',
'0','0','0','0','0','0','0','0','0','0','0','1','0','0','0','0'),
--////////////////Line 4////////////////////////////////////////////
('0','0','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','1','0','0','0',
'0','0','1','0','0','0','0','0','0','1','0','0',
'0','0','0','0','0','0','0','0',
'0','1','1','1','1','1','1','1','1','1','1','1','1','0','0','0',
'0','0','0','0','0','0','0','0','0','0','1','0','0','0','0','0'),
--////////////////Line 5/////////////////////////////////////////
('0','0','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','0','1','0','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',
'0','1','0','0','0','0','1','0','0','0','0','1','0','0','0','0',
'0','0','0','0','0','0','0','0','0','1','0','0','0','0','0','0'),
--////////////////Line 6//////////////////////////////////////////
('0','0','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','0','0','1','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',
'0','1','0','0','0','0','1','0','0','0','0','1','0','0','0','0',
'0','0','0','0','0','0','0','1','1','0','0','0','0','0','0','0'),
--///////////////Line 7//////////////////////////////////////////////
('0','0','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','0','0','1','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',
'0','1','1','1','1','1','1','1','1','1','1','1','0','0','0','0',
'0','0','0','0','0','0','0','1','0','0','0','0','0','1','0','0'),  
--/////////////Line 8/////////////////////////////////////////////
('0','1','1','1','1','1','1','1','1','1','1','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','1','1','1','1','1','1','1','1','0','0',
'0','0','1','0','0','0','0','0','0','0','1','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
  '0','1','1','1','1','1','1','0',
'0','1','0','0','0','0','1','0','0','0','0','1','0','0','0','0',
'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','0'),
--////////////////Line 9/////////////////////////////////////////
('0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','0','0','1','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','1','1','1','1','1','1','0',
'0','1','0','0','0','0','1','0','0','0','0','1','0','0','0','0',
'0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0'),
--/////////////////Line 10///////////////////////////////////////
('0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','0','0','1','0',
'0','1','1','1','1','1','1','1','1','1','1','0',
'0','0','0','0','0','0','0','0',
'0','1','1','1','1','1','1','1','1','1','1','1','0','0','0','0',
'0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0'),
--//////////////////Line 11////////////////////////////////////////////
('0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','0','0','1','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',
'0','1','0','0','0','0','1','0','0','0','0','1','0','0','0','0',
'0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0'),  
--//////////////////Line 12///////////////////////////////////////
('0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','0','1','0','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',

'0','0','0','0','0','0','1','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0'),
--///////////////////Line 13//////////////////////////////////////
('0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','0','1','0','0','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',

'0','0','0','0','0','0','1','0','0','0','0','0','0','1','0','0',
'0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0'),
--////////////////////Line 14/////////////////////////////////////
('0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','0','1','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',

'0','0','0','0','0','0','1','0','0','0','0','0','0','1','0','0',
'0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0'),
--////////////////////Line 15///////////////////////////////////////
('0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','0','0',
'0','0','1','0','0','0','1','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',


'0','0','0','0','0','0','0','1','1','1','1','1','1','1','0','0',
'0','0','0','0','0','1','0','1','0','0','0','0','0','0','0','0'),
--/////////////////////Line 16////////////////////////////////////
('1','1','1','1','1','1','1','1','1','1','1','0',
'0','0','1','1','1','1','1','1','1','1','0','0',
'0','1','1','1','1','1','1','1','1','1','0','0',
'0','1','1','1','1','1','0','0','0','0','0','0',
'0','1','0','0','0','0','0','0','0','0','1','0',
'0','0','0','0','0','0','0','0',

'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','1','0','0','0','0','0','0','0','0','0')
--/////////////////////////////////////////////////////////////////

);

        
variable Line:integer:=0;
variable Pixel:integer:=0;

begin       --initial the screen
  if Clk25'event and Clk25 = '1' then
   if (Horizontal_Counter >= "0010010000" ) -- 144   why from 144?
   and (Horizontal_Counter < "1100010000" ) -- 784   640+100
   and (Vertical_Counter >= "0000100111" ) -- 39     why from 39?
      and (Vertical_Counter < "1000000111" ) -- 519     480+39
   then
    Red_out <= '0';
    Green_out <= '0';
    Blue_out <='0';
    -----Line 1  
      -- if (Horizontal_Counter >=  "0110111000" )--440    640/2-24+144
      if (Horizontal_Counter >=  "0110111000" )--440    640/2-24+144 x
    --  and (Horizontal_Counter <= "0111101000")-- 488    640/2+24+144
    and (Horizontal_Counter <= "1000011100")-- 488    640/2+24+144
      and (Vertical_Counter >= "0011101000") --232      240-8   y
      and (Vertical_Counter <= "0011110111") then -- 247  240+8-1
       if(Pixel <= 99) then --Line 1 Lets make our Text WHITE
         Red_out <= char_L1(Line, Pixel);
       Green_out <= char_L1(Line, Pixel);
       Blue_out <= char_L1(Line, Pixel);
       Pixel:= Pixel+1;
       elsif(Pixel >= 99) then  -- All else BLACK
        Red_out <= '0';
      Green_out <= '0';
      Blue_out <= '0';
       end if;
     end if;
     end if;
   if (Horizontal_Counter > "0000000000" )
        and (Horizontal_Counter < "0001100001" ) -- 96+1   generate the hs_out and the vs_out
       then
       hs_out <= '0';
       else
           hs_out <= '1';
      end if;
   if (Vertical_Counter > "0000000000" )
        and (Vertical_Counter < "0000000011" ) -- 2+1
       then
         vs_out <= '0';
       else
         vs_out <= '1';
      end if;

   Horizontal_Counter <= Horizontal_Counter+"0000000001";
      if (Horizontal_Counter="1100100000") then    --800? decide the frequency of Hs 50000000/2/800 = 31.25K Hz
        Vertical_Counter <= Vertical_Counter+"0000000001";
        Horizontal_Counter <= "0000000000";
    Pixel:= 0;
    if (Vertical_Counter >= "0011101000") -- First Line  232
       and (Vertical_Counter <= "0011110111") then     --247   
      if (Line <= 31) then
        Line:= Line+1;
      elsif (Line >= 32) then
        Line:= 0;
      end if;
     end if;
      end if;
      if (Vertical_Counter="1000001001") then  --521?  decide the frequency of Hs 50000000/2/800/521 = 59.98 Hz   
        Vertical_Counter <= "0000000000";
    Line:= 0;
      end if;
    end if;
end process;   
end Behavioral;
发表于 2013-8-22 12:01:05 | 显示全部楼层
process (clk50_in)
begin
if clk50_in'event and clk50_in='1' then
   if (Clk25 = '0')then
     Clk25 <= '1' after 2 ns;
   else
     Clk25 <= '0' after 2 ns;
  end if;
end if;
end process;     
可以综合吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-1 16:15 , Processed in 0.017315 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表