Help :cry: !!!!
Hi everybody, I was trying to generate the video signal with a Cyclone board from Altera using a crystal with 50 MHz.
When i download the code into the FPGA I have the problem that I cannot control every single pixel nor line. When I try to draw one line white and one line black; and so on; there seems to be an overlapping problem between vertical lines, although the timing I've used is correct. But not in every single line; that occurs perhaps every 50 or 60 lines, the lines appear mixed by 3 or 4 lines with some kind of blur, then the next 50 lines are ok again and so on, this is quite weird.
if anyone know what's the problem, I'd appreciate some help. I attach the code below, very simple.
-- new clock frequency, 50MHz /2 = 25 MHz
new_clock <= not new_clock when rising_edge(clock) else
unaffected;
-- this process generates exacly 31.8 us for the complete H signal
Process(new_clock, reset)
Begin
if reset = '0' then
Counter_HS <= (others => '0');
Counter_VS <= (others => '0');
elsif rising_edge(new_clock) then
if Counter_HS = 795 then
Counter_HS <= (others => '0');
Counter_VS <= Counter_VS + 1;
else
Counter_HS <= Counter_HS + 1; end if;
end if;
End Process;
-- This process generates the 3.76 us for syncronize the H signal
Process(new_clock, reset)
Begin
if reset = '0' then
vga_HS <= '1';
elsif rising_edge(new_clock) then
if Counter_HS < 94 then
vga_HS <= '0';
else
vga_HS <= '1';
end if;
end if;
End process;
-- This process generates the 63.6 ms for syncronize the V signal
Process(new_clock, clock, reset)
Begin
if reset = '0' then
vga_VS <= '1';
elsif rising_edge(new_clock) then
if Counter_VS < 1 then
vga_VS <= '0';
else
vga_VS <= '1';
end if;
end if;
End process;
-----------------------------------------------------------------------
-- Just paint one line color, and line black and so on.
Process(new_clock, clock, reset)
Begin
if reset = '0' then
elsif rising_edge(new_clock) then
if Counter_HS > 142 and Counter_HS < 780 and
Counter_VS > 5 and Counter_VS < 470 then
RGB<= Counter_HS(0)&"00";
else
RGB <= "000";
end if;
end if;
End process;