hitx
Member level 2
- Joined
- Mar 16, 2007
- Messages
- 49
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Activity points
- 1,723
Hi dear friends,
I have a serious problem about Spartan 3E, x3c100K cp132 family. I have to control a monitor to display various color using VGA port. This might be easy, but I am beginner for VHDL. However, I have not managed yet. And I am becoming much more crazy :twisted: I need a VGA controller in VHDL. I used lots of codes from internet, but I saw only black screen on monitor. :grin: Probebly I missed something in codes. I really need help.
I found a code in VHDL for VGA controller below. This codes never gives any error. But I did not see anything on monitor. What should I do? Please help me.
Thanks.
PLEASE USE CODE TAGS IN THE FUTURE
I have a serious problem about Spartan 3E, x3c100K cp132 family. I have to control a monitor to display various color using VGA port. This might be easy, but I am beginner for VHDL. However, I have not managed yet. And I am becoming much more crazy :twisted: I need a VGA controller in VHDL. I used lots of codes from internet, but I saw only black screen on monitor. :grin: Probebly I missed something in codes. I really need help.
I found a code in VHDL for VGA controller below. This codes never gives any error. But I did not see anything on monitor. What should I do? Please help me.
Thanks.
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity vgatest 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 vgatest; architecture behavioral of vgatest is signal clk25 : std_logic; signal hcounter : integer range 0 to 800; signal vcounter : integer range 0 to 521; signal color: std_logic_vector(2 downto 0); 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; -- change color every one second p1: process (clk25) variable cnt: integer; begin if clk25'event and clk25='1' then cnt := cnt + 1; if cnt = 25000000 then color <= color + "001"; cnt := 0; end if; end if; end process; p2: process (clk25, hcounter, vcounter) variable x: integer range 0 to 639; variable y: integer range 0 to 479; begin -- hcounter counts from 0 to 799 -- vcounter counts from 0 to 520 -- x coordinate: 0 - 639 (x = hcounter - 144, i.e., hcounter -Tpw-Tbp) -- y coordinate: 0 - 479 (y = vcounter - 31, i.e., vcounter-Tpw-Tbp) x := hcounter - 144; y := vcounter - 31; if clk25'event and clk25 = '1' then -- To draw a pixel in (x0, y0), simply test if the ray trace to it -- and set its color to any value between 1 to 7. The following example simply sets -- the whole display area to a single-color wash, which is changed every one -- second. if x < 640 and y < 480 then red_out <= color(0); green_out <= color(1); blue_out <= color(2); else -- if not traced, set it to "black" color red_out <= '0'; green_out <= '0'; blue_out <= '0'; end if; -- Here is the timing for horizontal synchronization. -- (Refer to p. 24, Xilinx, Spartan-3 Starter Kit Board User Guide) -- Pulse width: Tpw = 96 cycles @ 25 MHz -- Back porch: Tbp = 48 cycles -- Display time: Tdisp = 640 cycles -- Front porch: Tfp = 16 cycles -- Sync pulse time (total cycles) Ts = 800 cycles if hcounter > 0 and hcounter < 97 then hs_out <= '0'; else hs_out <= '1'; end if; -- Here is the timing for vertical synchronization. -- (Refer to p. 24, Xilinx, Spartan-3 Starter Kit Board User Guide) -- Pulse width: Tpw = 1600 cycles (2 lines) @ 25 MHz -- Back porch: Tbp = 23200 cycles (29 lines) -- Display time: Tdisp = 38400 cycles (480 lines) -- Front porch: Tfp = 8000 cycles (10 lines) -- Sync pulse time (total cycles) Ts = 416800 cycles (521 lines) if vcounter > 0 and vcounter < 3 then vs_out <= '0'; else vs_out <= '1'; end if; -- horizontal counts from 0 to 799 hcounter <= hcounter+1; if hcounter = 800 then vcounter <= vcounter+1; hcounter <= 0; end if; -- vertical counts from 0 to 519 if vcounter = 521 then vcounter <= 0; end if; end if; end process; end behavioral;
PLEASE USE CODE TAGS IN THE FUTURE
Last edited by a moderator: