VGA-terminal With PIC18 (PIC24)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

8/7/2014 VGA-terminal with PIC18 [PIC24]

http://www.pic24.ru/doku.php/en/osa/articles/vga_terminal 1/4
VGA-terminal with PIC18
This article tells how to output data to VGA monitor using controller PIC18. This controller is not quite well for tasks like this, but this example shows that it isn't impossible. This program was written in 2004,
and it is introduced here just for describe principles of "VGA game with PIC18" project.
Source code is here: terminal.rar
Specification:
Text screen resolution30x30 chars
Graphics resolution 240x480 pixels
Char size 8x16 pixels
Colors 15
Cursor emulating Yes.
Char set English, Russian
Interface SPI, up to 250 kbits per second
There are two limitations:
1. background color is always black;
2. one symbol can be drown with one colour only.
Here is demo mode generated screen. (Ptogram was written in 2004, and demo-screen function was added just now for demonstration purpose):
VGA colntrol
Some theory
VGA monitor is controlled by 5 wires:
2 digital wires (horisontal and vertical syncho pulses);
3 analog wires (reg, green and blue levels).
Syncronization wires used to tell to monitor when frame started and how march frames per second. Analog wires used to specify color of every pixel on the screen. The higher voltage on wire brings the
brighter color. By combinating different voltage levels on three RGB wires we can gen different colors (e.g. when generating simmilar levels for red and green wires and zero level for blue wire, we will get
yellow color).
The picture on the sreen is drawed line by line from the top to the bottom. Each line drown left to right. When line fully drown, horisontal synchronization pulse will be generated (HSYNC) to tell to monitor
that next part of information should be drown at next line. When all lines are drown, verlical sinchronization pulse (VSYNC) will be generated to tell to monitor that frame is over and next information should
be outputed from the top of the screen.
Frame rate must be greater than 60 Hz to prevent blinking. In standart VGA-mode each frame consist of 525 lines. 480 of them contain picture, and other contain top and bottom borders and blank lines for
vertical sinchro (they have not color information). Each line is splitted at several parts: video information, left and right borders, horisontal blanking pulse.
The lenght of line = 1s /60 frames / 525 lines = 31.75 us.
Here is a picture dscribing data transfer to VGA:
8/7/2014 VGA-terminal with PIC18 [PIC24]
http://www.pic24.ru/doku.php/en/osa/articles/vga_terminal 2/4
Picture generating
(not finished, see page in russian)
Synchro pulses
(not finished, see page in russian)
Scheme
8/7/2014 VGA-terminal with PIC18 [PIC24]
http://www.pic24.ru/doku.php/en/osa/articles/vga_terminal 3/4
Test application
Here is a small test application for PIC16F88
Source code
This aplication draws this picture:
8/7/2014 VGA-terminal with PIC18 [PIC24]
http://www.pic24.ru/doku.php/en/osa/articles/vga_terminal 4/4

en/osa/articles/vga_terminal.txt Last modified: 23.09.2011 12:22 by osa_chief

You might also like