Simple homemade VGA graphics card

As far as I know, quite a lot of people are interested in connecting the microcontroller to a regular monitor and trying to display something on the screen. This article will discuss the creation of the simplest VGA-video card based on the atmega168-20 microcontroller.

Generally speaking, this project is a hundred years old at lunchtime. But once I promised to talk about this video card here too, but everything was laziness. Now it's time to fulfill the promise.

This video card produces a picture with a resolution of 254x240 pixels with 256 colors. This whole thing works in the standard VGA mode 640x480 at 60 Hz sweep. I tested this video card with 6 monitors (1 CRT and 5 LCDs), while the card worked on all monitors, except for the Acer monitor. What he did not like the signal, I did not understand.

In the mock-up version, the video card looks like this: The



video card consists of two modules: a memory module and a DAC module.

The memory module simply generates synchronization signals (HS, VS) and beam blanking (BL) and gives out a color code (D0 ... D7), which the DAC module converts to 0-0.7 V and sends it to the monitor. The microcontroller of the memory module simply goes over the addresses of the static RAM, and the data from the RAM is the color of the dots. Using an Atmega168 microcontroller with a frequency of 20 MHz, 2 clock cycles per point are required, therefore this part of the program is written in assembler and expanded into a repeating fragment for each point of the line. I will allow myself not to describe the time-dependent sweep of the VGA signal, especially since the Internet is full of information on this subject (although it often does not coincide with each other), and over the past years I have already forgotten quite a bit what time chart I implemented in this video card.


Scheme of the memory module (opening in a new window, you can increase).

The DAC module consists of three ordinary R-2R DACs with keys and an output emitter follower (due to which a range of colors is "cut" a little). If anyone comes up with how cheaply and angrily to fix this "stabbing" - you are welcome to comment. On a radio cat I was advised to replace the emitter repeater with a source one, but I still did not check this advice. As you can see from the diagram, I assigned 3 bits to red, 3 bits to green and 2 bits to blue. I took transistors KT-315. :)


DAC circuit.

What exactly the video card will display is determined by the control controller. Its task is to set the address on the address bus (A0 ... A15), set the data on the data bus (D0 ... D7), set the signals WR (write to low level), OE (permission to output data at low level) and set A / B signal (switching memory to work with the control controller at a low level). The control controller receives a beam blanking signal (BL) from the memory card, which can be used to synchronize recording to the video card's memory.

Such a video card works like this:


Printed circuit boards and firmware with their source.

Good luck in the development of the project!

All Articles