:   Remember me     or  register yourself!
Advertisement
Home  arrow  Circuits  arrow  Microcontrollers  arrow  Simple VGA/Video adapter
Simple VGA/Video adapter

Description
Background
Several months ago I tried to connect a microcontroller system to a VGA monitor to output data in the form of text. I was surprised to find little on this subject on the internet, to assist me in achieving this goal. Certainly nothing simple a beginner could find useful.
There are examples out there that utilise standards such as PC-104 or complex FGPA implementations found at http://www.opencores.org. Other solutions include graphic controllers from Fujitsu or even one local Russian person who was offering for sale a project for $5000 on ACEX. These are fine but are little help to most hobbyists etc out there who wish to display text on a VGA or similar screen.
What I desired was a "quick and dirty"? solution that did not cost too much.
Initial calculations showed that the the AVR 8-bit microcontroller from ATMEL, with its 16Mhz clock speed providing approximately 16 MIPS was a good candidate for further research. Also note that newer AVRs such as the Mega48, Mega88 and Mega168 will officially support clock rates upto 20 Mhz. Therefore I concluded that with a clock of 16 Mhz I could achieve something in the order of 8 Mhz speed of data being transferred out of a port. I also chose the AVR as I had already built up quite a body of experience with it and so I began work of the project.
After approximately two to three months of research, I present you the fruits of my labour!

Goal
The problem which I have set myself is simple enough to enumerate. With commonly available microcontrollers like the Mega8, Mega16 and similar, and with a minimum of external components I wanted a design that would be capable of displaying at least 15x15 characters on a VGA monitor using standard VGA frequencies. The data itself is to be received by the microcontroller via its USART port. All using a 16 Mhz clock for the AVR.
The initial goal has been achieved. The project has expanded to include Monochomatic Video singal (PAL/SECAM). In my test set up a mere jumper determines whether the output is VGA or Composite Video.

Image below shows the result on a VGA screen:


And this image shows the result on a TV screen:



Schematic



Characteristics

VGA-terminal:
Quantity of symbols: 20 lines by 20 characters.
The resolution of a character matrix: 8x12 points
Supported code page: WIN 1251
Formed signal: VGA
The resolution: 640x480
Frequency of vertical synchronization: 60Hz
Speed of exchange UART 19200 bps

Video terminal:
Quantity of symbols: 20 lines by 38 characters.
The resolution of an individual character matrix: 8x12 points
Supported code page: WIN 1251
Formed signal: Composite Video (PAL/SECAM)
Resolution: 625 lines (interlaced)
Frequency of vertical synchronization: 50Hz
Speed of exchange UART 19200 bps

Type of the used microcontroller: Mega8, Mega16, Mega32, Mega8535, etc.

Clock frequency of the microcontroller standard - 16Mhz.

Notes:
1. To avoid distortion of the image, when receiving data through the UART, for VGA, it is recommended to make the data exchange with the terminal in approximately 300-600 us after a signal of vertical synchronization (VSYNC).
2. The available internal RAM of the Mega8535 (only 512 bytes) is not enough for the formation of a Video signal with a resolution of 38x20 symbols.

Algorithm:


Explanation
The algorithm of rendering the image is traditional enough, the main know-how of the project is the bit-by-bit shifting of the image, utilising the SPI shift register SPDR via the MOSI pin. Thus two jobs are performed at the same time, when the subsequent byte for rendering is sent, the previous byte is shifted out through the shift register (SPI SPDR MOSI). The differences between figures below demonstrate this.





Conclusion

Given the project was written with WinAVR (GCC), it is relatively easy to increase the resolution and/or frequencies used in creating the display images. With the forthcoming availability of AVR microcontrollers such as the Mega48, Mega88 and Mega168 officially supporting clock speeds of 20Mhz it is possible to achieve resolutions of 20 lines by 25-30 characters. This is possible using exactly the same circuitry.
If need be, the code can be ported to other families of modern RISC microcontrollers with only minimal changes to the code. The main limitations are the need for at least 16 MIPS and a throughput via the SPI of not less than 8 megabits per second.

Applications

Applications of the project are not limited to only one terminal variant (look demo in a folder examples) - despite on serious congestion of the processor regeneration of the display
The remaining capacity has enough for the organization of processing for example several digital and analog signals and reaction to them, and also delivery of results of their measurements on the display in real-time (Security systems, Industrial automatics etc.). The author has the improved variants of similar systems with the resolution of the symbolical display 40x24 symbols in mode VGA, working in commercial products.

Useful references
Theory Video signal
Cornell University Electrical Engineering 476 - Generation of video signal on AVR
Theory VGA signal
Generation VGA signal on PIC

You can freely use materials of this project for educational and noncommercial purposes. All rights of this project are reserved by the author. Any reprinting, publication, including on the Internet, or use in commercial projects or similar, of materials in this project is expressly prohibited and only available with the express written consent of the author.

Copyright 2005: Ibragimov Maxim Rafikovich (simple-vga@rambler.ru)
The further development of the project seen on this site:Simple VGA adapters, other devices & Atmel AVR family

Partlist

Files
Posted by Jospfh at Mar 17 2006 15:40
Comments
May 1 2006 20:14
Dingo_aus
I've made an alpha stage design of a PCB for this circuit.

I've etched and populated this PCB at it works on one of my TVs well and not the other. It has worked with my CRT yet. I've got to go over it with a fine tooth comb.

Hope it helps anyone else looking for this sort of thing.

The link for it is:

http://www.users.on.net/~symes/Mega32/VGAboard.htm
Sep 14 2007 8:54
M Srinivas
Sir,
Iam using the same code and schematic as mentioned in website, but iam unable to display any data on the monitor. At present iam working with ATmega32 microntroller, WINAvr software on WIN 2000 OS to debug the code and universal programmer to dump the code. Can any one one help me where iam going wrong and which of these bits have to be enabled while programming.
1)CKSEL0
2)CKSEL1
3)CKSEL2
4)CKSEL3
5)BODLEVEL
6)JTAG
7)EESAVE
8)SUT0
9)SUT1
10)BODEN
11)BOOTRST
12)BOOTSZ0
13)BOOTSZ1
14)CKOPT
15)SPIEN
16)OCD

Waiting for your reply
Regards,
M Srinivas
Leave a comment
If you have a question please go to the Forum and post your question there.

Name
Required
Mail
Required but not shown
Code

Please enter the code
  code
Comment
Please enter your comment.