Simple VGA/Video adapter

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.

Background 

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 15×15 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: 8×12 points
  • Supported code page: WIN 1251
  • Formed signal: VGA
  • The resolution: 640×480
  • 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: 8×12 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 38×20 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 40×24 symbols in mode VGA, working in commercial products.

Useful references

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

5 thoughts on “Simple VGA/Video adapter

  1. K_M

    the thing you’ve needed was just teletext IC which can be found in almost every CRT from 80s and newer. These are pretty well documented, and in 2015 somebody managed to turn one of such IC into “kind of” graphic card and drive it with Raspberry PI. You can find the project on hackaday.

Leave a Reply

Your email address will not be published. Required fields are marked *