VGA 640x480 mit DE1?

#3621348
Lesenswert?

@ Peter Bierbach (funkheld)

>Der Bildschirm schaltet auf 640x480 um, bleibt aber dunkel.

Wenn man kein Signal ausgibt ist das nur logisch.

>Ist das richtig, wenn ja, wie bekomme ich jetzt einfach mal einen
>Querbalken?

Dann musst du auf deinen Zeilenzähler "schauen" und während Zeile X-Y an 
den RGB Daten ein Signal anlegen.
OP #3623021
Lesenswert?

Hallo, guten Tag.

Das müßte doch der X-Y-Zähler sein , oder:
-------------------------
process (clk25)
begin
  if clk25'event and clk25 = '1' then
    if hcounter<640 then
      if vcounter < 240 then
         blue_out<='1';
      else
         blue_out<='0';
      end if;

     if vcounter > 120 and vcounter < 360 then
        green_out<='1';
      else
        green_out<='0';
     end if;
    else
     blue_out<='0';
     green_out<='0';
    end if;
 end if;
end process;
-------------------------------

Danke.
Gruss
OP #3623043
Lesenswert?

War falsch da oben, hat nur "0" bis "10".

Aber es kommt kein Bild mit dem Balken.

Habe die Pins vom DE1 zugewiesen und funktioniert nicht:

set_location_assignment PIN_A9 -to blue_out
set_location_assignment PIN_L1 -to clk50_in
set_location_assignment PIN_B8 -to green_out
set_location_assignment PIN_A11 -to hs_out
set_location_assignment PIN_D9 -to red_out
set_location_assignment PIN_B11 -to vs_out

-------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.ALL;

entity vga_timing 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_timing;

architecture behavioral of vga_timing is

signal clk25 : std_logic:='0';
signal hcounter : unsigned (9 downto 0):=to_unsigned(0,10);
signal vcounter : unsigned (9 downto 0):=to_unsigned(0,10);

begin

-- generate a 25Mhz clock
process (clk50_in)
begin
  if clk50_in'event and clk50_in='1' then
    clk25 <= not clk25;
  end if;
end process;

process (clk25)
begin
  if clk25'event and clk25 = '1' then
    if vcounter<480 then
      if hcounter < 320 then
        red_out<='1';
      else
        red_out<='0';
      end if;
    else
      red_out<='0';
    end if;
  end if;
end process;

process (clk25)
begin
  if clk25'event and clk25 = '1' then
    if hcounter<640 then
      if vcounter < 240 then
         blue_out<='1';
      else
         blue_out<='0';
      end if;

     if vcounter > 120 and vcounter < 360 then
        green_out<='1';
      else
        green_out<='0';
     end if;
    else
     blue_out<='0';
     green_out<='0';
    end if;
 end if;
end process;

process (clk25)
begin

  if clk25'event and clk25 = '1' then
    if hcounter >= (639+16) and hcounter <= (639+16+96) then
      hs_out <= '0';
    else
      hs_out <= '1';
    end if;

    if vcounter >= (479+10) and vcounter <= (479+10+2) then
      vs_out <= '0';
     else
      vs_out <= '1';
    end if;

-- horizontal counts from 0 to 799
    hcounter <= hcounter+1;

    if hcounter = 799 then
      vcounter <= vcounter+1;
      hcounter <= to_unsigned(0,10);
    end if;

-- vertical counts from 0 to 524
    if vcounter = 524 then
      vcounter <= to_unsigned(0,10);
    end if;
  end if;
end process;

end behavioral;
------------------------------

Danke.
Gruss
Gast #3623229
Lesenswert?

Das DE1 hat einen simplen 4 bit DAC in Form einen Widerstandnetzwerkes 
für die Farben am VGA Port.
Wenn du nur ein Bit und obendrein das niederwertigste ansteuerst wird 
das Bild einfach zu dunkel sein, als dass du etwas sehen kannst.
OP #3623328
Lesenswert?

Hmmm..., mit den Farbvectoren läuft jetzt dieses VGA-Programm.
Habe jetzt die Farbwerte je Farbe in 4 Vectoren gepackt für das DE1.

Das Programm, welches nach Pinbelegung funktioniert :
-----------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.ALL;

entity vga_timing is
port(
  clk50_in  : in std_logic;
  hs_out    : out std_logic;
  vs_out    : out std_logic;

  red_out   : OUT STD_LOGIC_VECTOR(3 downto 0);
  green_out : OUT STD_LOGIC_VECTOR(3 downto 0);
  blue_out  : OUT STD_LOGIC_VECTOR(3 downto 0)
  );
end vga_timing;

architecture behavioral of vga_timing is

signal clk25    : std_logic:='0';
signal hcounter : unsigned (9 downto 0):=to_unsigned(0,10);
signal vcounter : unsigned (9 downto 0):=to_unsigned(0,10);

begin

-- generate a 25Mhz clock
process (clk50_in)
begin
  if clk50_in'event and clk50_in='1' then
    clk25 <= not clk25;
  end if;
end process;

process (clk25)
begin
  if clk25'event and clk25 = '1' then
    if vcounter<480 then
      if hcounter < 320 then
        red_out<="1000";
      else
        red_out<="0000";
      end if;
    end if;
  end if;
end process;

process (clk25)
begin
  if clk25'event and clk25 = '1' then
    if vcounter<480 then
      if (hcounter > 320 and hcounter < 640) then
        green_out<="1000";
      else
        green_out<="0000";
      end if;
    end if;
  end if;
end process;

process (clk25)
begin

  if clk25'event and clk25 = '1' then
    if hcounter >= (639+16) and hcounter <= (639+16+96) then
      hs_out <= '0';
    else
      hs_out <= '1';
    end if;

    if vcounter >= (479+10) and vcounter <= (479+10+2) then
      vs_out <= '0';
     else
      vs_out <= '1';
    end if;

-- horizontal counts from 0 to 799
    hcounter <= hcounter+1;

    if hcounter = 799 then
      vcounter <= vcounter+1;
      hcounter <= to_unsigned(0,10);
    end if;

-- vertical counts from 0 to 524
    if vcounter = 524 then
      vcounter <= to_unsigned(0,10);
    end if;
  end if;
end process;

end behavioral;
---------------------------------------

Hier die Pinbelegung gemäß Programm:
---------------------------------------
set_location_assignment PIN_L1 -to clk50_in
set_location_assignment PIN_A11 -to hs_out
set_location_assignment PIN_B11 -to vs_out
set_location_assignment PIN_A9 -to blue_out[0]
set_location_assignment PIN_D9 -to red_out[0]
set_location_assignment PIN_B8 -to green_out[0]
set_location_assignment PIN_B10 -to blue_out[3]
set_location_assignment PIN_A10 -to blue_out[2]
set_location_assignment PIN_A8 -to green_out[3]
set_location_assignment PIN_B9 -to green_out[2]
set_location_assignment PIN_C10 -to green_out[1]
set_location_assignment PIN_B7 -to red_out[3]
set_location_assignment PIN_A7 -to red_out[2]
set_location_assignment PIN_C9 -to red_out[1]
set_location_assignment PIN_D11 -to blue_out[1]
--------------------------------------------

Gruss

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren