Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to display characters on a vga console?

Status
Not open for further replies.

superhet

Junior Member level 3
Joined
Jun 7, 2005
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,599
vga console

i have made a 640x480 VGA controller in verilog. as a test i generated red green and blue lines on a monitor. but now i want to display alphanumeric characters. i have some idea about using a character buffer and a font ROM. but can someone please tell me how i should do it?
 

Re: vga console

First of all, everything should be pipelined.

So, in your stages, for each line, you can
- Read the character to be printed.
- Calculate the ROM address based on the character and line number (this can involve only bit shifting).
- Read the ROM data and use it to print out the character.

As said, to speed-up, this should be pipelined. The thing to remember is that you read the characters/ROM data in advance (ex: one to 2 characters ahead).

If you have shared memory (not dual-port) which is shared between graphic processor and the CPU, you may need a memory arbitrer, so that only one of the 2 access the memory at one time, and get more buffer when reading characters/ROM data. Alternatively, you can let the CPU have priority over the graphic engine, so when the CPU is reading/writing to video memory, that the graphic engine does not interfere with CPU reading/writing the memory. The downside is that at the time the CPU access video memory, the graphic engine will get invalid data (presumably all-zero or all-ones). That is, by the way, the way the old CGA controllers (before VGA and EGA) worked. If you remember that time, you'll remember the 'snow' caused on those CGA adaptors :)
 

    superhet

    Points: 2
    Helpful Answer Positive Rating
Re: vga console

Check this link out, it has a demo for an ascii to VGA controller to be implemented in a Spartan-3 Starter Kit board.

**broken link removed**
 

    superhet

    Points: 2
    Helpful Answer Positive Rating
Re: vga console

thanx for your help.

actually i am going to use the Picoblaze microcontroller to control the characters to be displayed on a VGA monitor. the Picoblaze microcontroller will get the character from the UART and then accordingly display it.

im having some difficulty in figuring out how to make the font ROM. will i have to make bitmaps of each alphanumeric character and then store it in a BlockRAM configured as a ROM or is there a better way.

the second thing is that how can i manipulate the positioning of the characters like a gotoxy() function sort of thing.

and thanx for the tip about pipelining. i will keep that in mind.
 

Re: vga console

Well, you may be able to find fonts on the Net, but if you have the skill, you can dump an 8x8 character set from your PC BIOS. Every BIOS have some character sets at pre-defined places.

Now, let me search where it is...

Ok, from my trusty old system info bible:

----------------------------------------------------------------------

INT 1F ---- - SYSTEM DATA - 8x8 GRAPHICS FONT


Category: B - BIOS

Inp.:
Desc: this vector points at 1024 bytes of graphics data, 8 bytes for each
character 80h-FFh
Note: graphics data for characters 00h-7Fh stored at F000h:FA6Eh in 100%
compatible BIOSes
SeeAlso: INT 10/AX=5000h,INT 43
INT 1F

Copied from Ralf Brown's Interrupt List

----------------------------------------------------------------------

Also

----------------------------------------------------------------------

INT 43 ---- - VIDEO DATA - CHARACTER TABLE (EGA,MCGA,VGA)


Category: V - video

Inp.:
Desc: points at graphics data for characters 00h-7Fh of the current font
in 8x8 dot modes, graphics data for all characters in 8x14 and 8x16
modes
Note: this is not a callable vector!
SeeAlso: INT 06"no-name",INT 1F"SYSTEM DATA",INT 44"VIDEO"
INT 43

Copied from Ralf Brown's Interrupt List

----------------------------------------------------------------------

Big Boy
 

    superhet

    Points: 2
    Helpful Answer Positive Rating
Re: vga console

thanx, but isnt there a simpler way?

Added after 12 minutes:

Check this link out, it has a demo for an ascii to VGA controller to be implemented in a Spartan-3 Starter Kit board.

h**p://gforge.openchip.org/softwaremap/trove_list.php?form_cat=312

actually i dont know VHDL. could you help me understand how this was done in the link that you gave me
 

Re: vga console

Perhaps this can help you

Code:
----------------------------------------------------------------------------------
-- Company: 
-- Engineer: 
-- 
-- Create Date:    11:33:38 03/25/2006 
-- Design Name: 
-- Module Name:    digito_letra_rom - Behavioral 
-- Project Name: 
-- Target Devices: 
-- Tool versions: 
-- Description: 
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity digito_letra_rom is
	Port(letra: in std_logic_vector(5 downto 0);
		  columna: in std_logic_vector(2 downto 0);
		  fila: in std_logic_vector(2 downto 0);
		  pixel: out std_logic);
end digito_letra_rom;

architecture Behavioral of digito_letra_rom is
	type datos is array (0 to 51) of STD_LOGIC_VECTOR(0 to 34);
	constant letra_rom: datos  := (
	"01110"& --A (0)
	"10001"&
	"10001"&
	"10001"&
	"11111"&
	"10001"&
	"10001",
	"11110"& --B (1)
	"10001"&
	"10001"&
	"11110"&
	"10001"&	
	"10001"&
	"11110",
	"01110"& --C (2)
	"10001"&
	"10000"&
	"10000"&
	"10000"&	
	"10001"&
	"01110",	
	"11110"& --D (3)
	"10001"&
	"10001"&
	"10001"&
	"10001"&	
	"10001"&
	"11110",	
	"11111"& --E (4)
	"10000"&
	"10000"&
	"11100"&
	"10000"&	
	"10000"&
	"11111",	
	"11111"& --F (5)
	"10000"&
	"10000"&
	"11100"&
	"10000"&	
	"10000"&
	"10000",	
	"01110"& --G (6)
	"10001"&
	"10000"&
	"10111"&
	"10001"&	
	"10001"&
	"01110",		
	"10001"& --H (7)
	"10001"&
	"10001"&
	"11111"&
	"10001"&	
	"10001"&
	"10001",		
	"01110"& --I (8)
	"00100"&
	"00100"&
	"00100"&
	"00100"&	
	"00100"&
	"01110",			
	"00111"& --J (9)
	"00010"&
	"00010"&
	"00010"&
	"00010"&	
	"10010"&
	"01100",	
	"10001"& --K (10)
	"10010"&
	"10100"&
	"11000"&
	"10100"&	
	"10010"&
	"10001",	
	"10000"& --L (11)
	"10000"&
	"10000"&
	"10000"&
	"10000"&	
	"10000"&
	"11111",	
	"10001"& --M (12)
	"11011"&
	"10101"&
	"10001"&
	"10001"&	
	"10001"&
	"10001",	
	"10001"& --N (13)
	"10001"&
	"11001"&
	"10101"&
	"10011"&	
	"10001"&
	"10001",	
	"01110"& --0 (14)
	"10001"&
	"10001"&
	"10001"&
	"10001"&	
	"10001"&
	"01110",	
	"11110"& --P (15)
	"10001"&
	"10001"&
	"11110"&
	"10000"&	
	"10000"&
	"10000",	
	"01110"& --Q (16)
	"10001"&
	"10001"&
	"10001"&
	"10101"&	
	"10010"&
	"01101",	
	"11110"& --R (17)
	"10001"&
	"10001"&
	"11110"&
	"10100"&	
	"10010"&
	"10001",	
	"01111"& --S (18)
	"10000"&
	"10000"&
	"01110"&
	"00001"&	
	"00001"&
	"11110",	
	"11111"& --T (19)
	"00100"&
	"00100"&
	"00100"&
	"00100"&	
	"00100"&
	"00100",	
	"10001"& --U (20)
	"10001"&
	"10001"&
	"10001"&
	"10001"&	
	"10001"&
	"01110",	
	"10001"& --V (21)
	"10001"&
	"10001"&
	"10001"&
	"10001"&	
	"01010"&
	"00100",	
	"10001"& --W (22)
	"10001"&
	"10001"&
	"10001"&
	"10101"&	
	"10101"&
	"01010",	
	"10001"& --X (23)
	"10001"&
	"01010"&
	"00100"&
	"01010"&	
	"10001"&
	"10001",	
	"10001"& --Y (24)
	"10001"&
	"10001"&
	"01010"&
	"00100"&	
	"00100"&
	"00100",		
	"11111"& --Z (25)
	"00001"&
	"00010"&
	"00100"&
	"01000"&	
	"10000"&
	"11111",	
	"01110"& --a (26)
	"10001"&
	"10001"&
	"10001"&
	"11111"&
	"10001"&
	"10001",
	"11110"& --b (27)
	"10001"&
	"10001"&
	"11110"&
	"10001"&	
	"10001"&
	"11110",
	"01110"& --c (28)
	"10001"&
	"10000"&
	"10000"&
	"10000"&	
	"10001"&
	"01110",	
	"11110"& --d (29)
	"10001"&
	"10001"&
	"10001"&
	"10001"&	
	"10001"&
	"11110",	
	"11111"& --e (30)
	"10000"&
	"10000"&
	"11100"&
	"10000"&	
	"10000"&
	"11111",	
	"11111"& --f (31)
	"10000"&
	"10000"&
	"11100"&
	"10000"&	
	"10000"&
	"10000",	
	"01110"& --g (32)
	"10001"&
	"10000"&
	"10111"&
	"10001"&	
	"10001"&
	"01110",		
	"10001"& --h (33)
	"10001"&
	"10001"&
	"11111"&
	"10001"&	
	"10001"&
	"10001",		
	"01110"& --i (34)
	"00100"&
	"00100"&
	"00100"&
	"00100"&	
	"00100"&
	"01110",			
	"00111"& --j (35)
	"00010"&
	"00010"&
	"00010"&
	"00010"&	
	"10010"&
	"01100",	
	"10001"& --k (36)
	"10010"&
	"10100"&
	"11000"&
	"10100"&	
	"10010"&
	"10001",	
	"10000"& --l (37)
	"10000"&
	"10000"&
	"10000"&
	"10000"&	
	"10000"&
	"11111",	
	"10001"& --m (38)
	"11011"&
	"10101"&
	"10001"&
	"10001"&	
	"10001"&
	"10001",	
	"10001"& --n (39
	"10001"&
	"11001"&
	"10101"&
	"10011"&	
	"10001"&
	"10001",	
	"01110"& --o (40)
	"10001"&
	"10001"&
	"10001"&
	"10001"&	
	"10001"&
	"01110",	
	"11110"& --p (41)
	"10001"&
	"10001"&
	"11110"&
	"10000"&	
	"10000"&
	"10000",	
	"01110"& --q (42)
	"10001"&
	"10001"&
	"10001"&
	"10101"&	
	"10010"&
	"01101",	
	"11110"& --r (43)
	"10001"&
	"10001"&
	"11110"&
	"10100"&	
	"10010"&
	"10001",	
	"01111"& --s (44)
	"10000"&
	"10000"&
	"01110"&
	"00001"&	
	"00001"&
	"11110",	
	"11111"& --t (45)
	"00100"&
	"00100"&
	"00100"&
	"00100"&	
	"00100"&
	"00100",	
	"10001"& --u (46)
	"10001"&
	"10001"&
	"10001"&
	"10001"&	
	"10001"&
	"01110",	
	"10001"& --v (47)
	"10001"&
	"10001"&
	"10001"&
	"10001"&	
	"01010"&
	"00100",	
	"10001"& --w (48)
	"10001"&
	"10001"&
	"10001"&
	"10101"&	
	"10101"&
	"01010",	
	"10001"& --x (49)
	"10001"&
	"01010"&
	"00100"&
	"01010"&	
	"10001"&
	"10001",	
	"10001"& --y (50)
	"10001"&
	"10001"&
	"01010"&
	"00100"&	
	"00100"&
	"00100",		
	"11111"& --z (51)
	"00001"&
	"00010"&
	"00100"&
	"01000"&	
	"10000"&
	"11111"
	
	);	
	signal direccion: std_logic_vector(5 downto 0);
begin

	WITH columna&fila SELECT
		direccion <= 
		   "000000" when "000000", --columna=0, fila=0
			"000001" when "001000",
			"000010" when "010000",	
			"000011" when "011000",
			"000100" when "100000", --columna=4, fila=0	
		   "000101" when "000001", --columna=0, fila=1
			"000110" when "001001",
			"000111" when "010001",	
			"001000" when "011001",
			"001001" when "100001", --columna=4, fila=1			
		   "001010" when "000010", --columna=0, fila=2
			"001011" when "001010",
			"001100" when "010010",	
			"001101" when "011010",
			"001110" when "100010", --columna=4, fila=2		
		   "001111" when "000011", --columna=0, fila=3
			"010000" when "001011",
			"010001" when "010011",	
			"010010" when "011011",
			"010011" when "100011", --columna=4, fila=3	
		   "010100" when "000100", --columna=0, fila=4
			"010101" when "001100",
			"010110" when "010100",	
			"010111" when "011100",
			"011000" when "100100", --columna=4, fila=4			
		   "011001" when "000101", --columna=0, fila=5
			"011010" when "001101",
			"011011" when "010101",	
			"011100" when "011101",
			"011101" when "100101", --columna=4, fila=5	
		   "011110" when "000110", --columna=0, fila=6
			"011111" when "001110",
			"100000" when "010110",	 
			"100001" when "011110",
			"100010" when "100110", --columna=4, fila=6					
			"000000" when others; --0 si otros
			
	pixel <= '0' when letra>51 else letra_rom(conv_integer(letra))(conv_integer(direccion));
end Behavioral;
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top