刚学CPLD 写VGA彩条显示,写竖条有用。写横条就成了线了。。
高手指点。。帮忙开下光啊。。不胜感激。。。./emotion/em068.giflibrary ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity VGA is
port(clk50MHz: in std_logic;
sw: in std_logic_vector(1 downto 0);
HS: out std_logic;
VS: out std_logic;
R,G,B: out std_logic
);
end entity VGA;
architecture first of VGA is
signal clk: std_logic;
signal count_h: std_logic_vector(9 downto 0);
signal count_v: std_logic_vector(9 downto 0);
signal RGB,RGB_V,RGB_H: std_logic_vector(0 to 2);
signal HS1,VS1: std_logic;
begin
p0:process(clk50MHz)
variable aa: integer range 0 to 12587500;
begin
if clk50MHz'event and clk50MHz='1' then
if aa<12587499 then aa:=aa+1;clk<=not clk;
else aa:=0;
end if;
end if;
end process p0;
p1:process(clk)--行像素点计数
begin
if clk'event and clk='1' then
if count_h<800 then
if count_h<96 then HS1<='0';
else HS1<='1';
end if;
count_h<=count_h+1;
else count_h<="0000000000";
end if;
end if;
end process p1;
-- p2:process(count_h) --行消隐信号
-- begin
-- if count_h<96 then HS1<='0';
-- else HS1<='1';
-- end if;
-- end process;
p3:process(clk)--显示竖状彩条
begin
if clk'event and clk='0' then
if count_h<144 then RGB_H<="000";
elsif count_h<224 then RGB_H<="001";
elsif count_h<304 then RGB_H<="010";
elsif count_h<384 then RGB_H<="011";
elsif count_h<464 then RGB_H<="100";
elsif count_h<544 then RGB_H<="101";
elsif count_h<=624 then RGB_H<="110";
elsif count_h<704 then RGB_H<="111";
elsif count_h<784 then RGB_H<="010";
else RGB_H<="000";
end if;
end if;
end process p3;
p4:process(HS1)--场像素点计数
begin
if HS1'event and HS1='1' then
if count_v<525 then
if count_v<10 then VS1<='0';
else VS1<='1';
end if;
count_v<=count_v+1;
else count_v<="0000000000";
end if;
end if;
end process p4;
-- P5:process(count_v)--场消隐信号
-- begin
-- if count_v<2 then VS1<='0';
-- else VS1<='1';
-- end if;
-- end process p5;
p6:process(clk)
begin
if clk'event and clk='0' then
if count_v<35 then RGB_V<="000";
elsif count_v<95 then RGB_V<="111";
elsif count_v<155 then RGB_V<="001";
elsif count_v<215 then RGB_V<="011";
elsif count_v<275 then RGB_V<="100";
elsif count_v<335 then RGB_V<="101";
elsif count_v<395 then RGB_V<="110";
elsif count_v<455 then RGB_V<="111";
elsif count_v<515 then RGB_V<="001";
else RGB_V<="000";
end if;
end if;
end process p6;
p7:process(sw,RGB_V,RGB_H)
begin
if sw="01" then RGB<=RGB_V;
else RGB<=RGB_H;
end if;
end process p7;
HS<=HS1;
VS<=VS1;
R<=RGB(2);
G<=RGB(1);
B<=RGB(0);
end first;
http://cache.amobbs.com/bbs_upload782111/files_43/ourdev_659728LL8XXF.jpg
显示的横条。 (原文件名:图像678.jpg) 没人理我。。不过还好刚去看了下时序图,结果发现是我在 p6 进程中没有行消隐。才会出错的。http://cache.amobbs.com/bbs_upload782111/files_43/ourdev_659798OOMWCC.jpg
VGA时序图 (原文件名:VGA时序图.jpg)
页:
[1]