Está en la página 1de 30

Controlador de VGA

Definiciones básicas
Capacidad de los display
Tubo de rayos catódicos
Display

Red
Green
Blue
(x0; y0) (x0; y1)

(x1; y0) (x1; y1)


Display
Display
Display (sincronización vertical)
VGA controller
VGA controller

Circuito a diseñar
VGA controller: señales de
sicronización Display 640x480
VGA controller: señales de
sicronización Display 640x480
VGA controller: parámetros
VGA controller: parámetros
Anotaciones sobre el controlador


vcount

hcount

Estándar: 640x480@60Hz Contadores para


recorrer todos los
pixeles
Dos señales:
hcount, std_logic_vector(10 downto 0); 0 ≤ hcount ≤ 800
vcount, std_logic_vector(10 downto 0); 0 ≤ vcount ≤ 525
T=40ns, F=25Mhz

0 … 648 744 800


HS
VS 0 … 482 484 525

RGB, std_logic_vector(11 downto 0) --R3R2R1R0GR3GR2GR1GR0B3B2B1B0


VGA controller: parámetros
Anotaciones sobre el controlador


Controla HS …
rst dor VS
11
clk hcont
11 vcount
rgb_in 11 VGA vcont
11
rgb_out
blank
Estándar: 640x480@60Hz hcount
Contadores

T=40ns, F=25Mhz

0 … 648 744 800


HS
VS 0 … 482 484 525
Contadores

T=40ns, F=25Mhz

0 … 648 744 800


HS
VS 0 … 482 484 525

hcounter: std_logic_vector(10 downto 0)


Contadores

T=40ns, F=25Mhz

0 … 648 744 800


HS
VS 0 … 482 484 525

hcounter: std_logic_vector(10 downto 0)


Contadores

T=40ns, F=25Mhz

0 … 648 744 800


HS
VS 0 … 482 484 525

hcounter: std_logic_vector(10 downto 0)


Contadores

T=40ns, F=25Mhz

0 … 648 744 800


HS
VS 0 … 482 484 525

hcounter: std_logic_vector(10 downto 0)


Vga_ctrl_640x480_60hz



12 11
rgb_in hcount
11 vcount
clk vcount
rst 12
rgb_out
HS
VS
hcount

Estándar: 640x480@60Hz Contadores para


recorrer todos los
pixeles
Dos señales:
hcount, std_logic_vector(10 downto 0); 0 ≤ hcount ≤ 800
vcount, std_logic_vector(10 downto 0); 0 ≤ vcount ≤ 525
T=40ns, F=25Mhz

0 … 648 744 800


HS
VS 0 … 482 484 525

rgb_out, std_logic_vector(11 downto 0) --R3R2R1R0GR3GR2GR1GR0B3B2B1B0


Cómo dibujar un cuadrado. Ejemplo

(200, 250) (200, 300)

(X0, y0) (X0, y1)


process(hcont,vcont)
begin
if(hcont >= 250 and hcont<=300)then
if(vcont >=200and vcont<= 250) then
rgbin<=“000011110000”
else
rgbin<=“111100000000”
(X1, y0) (X1, y1) endif;
else
(250, 250) (250, 300) rgbin<=“111100000000”
endif;
end process;

“000011110000” Verde RGB


“111100000000” Rojo RGB
Cómo mover el objeto ?

(pixel_x, pixel_y)

(0, 0)

T1= (X0=0, y0=50)) T1= (X0=100, y0=50)

(X0, y0) (X1, y0) (X0, y0)


(X1, y0)
Movimiento ?

(X0, y1) (X1, y1) (X0, y1) (X1, y1)

T1= (X1=50, y1=100) T1= (X1=150, y1=100)

(649,479)
Dibujar un display de 7 segmentos.

POSX-LW/2+DW) + POSY/2
xrectaneg1 <= xrectaneg - LW/2;

SHX1 SHY1 constant SHX1 : INTEGER := POSX;


(Posx,Posy) constant SHX2 : INTEGER := POSX + DW;
SVX2 constant SHY1 : INTEGER := POSY;
SVX1 DW SVX3 constant SHY2 : INTEGER := POSY + LW;
SVX4 constant SHY3 : INTEGER := POSY + DL/2 - LW/2;
LW constant SHY4 : INTEGER := POSY + DL/2 + LW/2;
SHY2 SHX2
constant SHY5 : INTEGER := POSY + DL – LW;
DL constant SHY6 : INTEGER := POSY + DL;
-- Segmentos Verticales
SHY3 constant SVY1 : INTEGER := POSY;
constant SVY2 : INTEGER := POSY + DL/2 + LW/2;
SHY4 constant SVY3 : INTEGER := POSY + DL/2 - LW/2;
SHY5 constant SVY4 : INTEGER := POSY + DL;
constant SVX1 : INTEGER := POSX;
SHY6 constant SVX2 : INTEGER := POSX + LW;
constant SVX3 : INTEGER := POSX + DW – LW;
constant SVX4 : INTEGER := POSX + DW;

if(segments(7)='1' and (HCOUNT>=SHX1)and(HCOUNT<=SHX2)and(VCOUNT>=SHY1)and(VCOUNT<=SHY2)) then

PAINT <= '1';


Dibujar un display de 7 segmentos.
Dibujar un display de 7 segmentos.
Dibujar un display de 7 segmentos.
Dibujar un display de 7 segmentos.
Ejemplo: Dibujar la salida de un contador de 0 - 999

a a a

f b f b f b
g g g

e c e c e c

d d d
Ejercicio: Dibujar una bandera.

Red
Green
Blue
(x1; y0)

(x0; y1) (x1; y1)

(x0; y2) (x1; y2)


(x1; y3)
(x0; y3)
Laboratorio 4: diseñar un juego simple.

Nombres Puntaje 2 dígitos

movimiento

figura

Tecla3 (dispara)

tecla2 tecla1

cañón

También podría gustarte