Image Indexing Group
A standard VGA monitor contains of
a grid of pixels typically 480 rows and 640 columns. Each pixel can display
various colors, depending on the state of the red, green and blue signals (R, G
and B) . A VGA monitor also has an internal clock that determines when each
pixel is refreshed, typically 25.175 MHz. The refresh behavior of the monitor
is partially controlled by the horizontal and vertical synchronization signals.
After the first pixel is refreshed, the monitor refreshes the remaining pixels
in the row in the raster scan mode. When the monitor receives a horizontal
synchronization signal, it retraces and then starts to refresh the second row
also in raster scan mode. By repeating this process until the scan reaches the
bottom of the monitor, the monitor will receive a vertical synchronization
signal and retrace back to the first pixel (top left corner). Although stated
above that normally the monitor only scans 640 pixels each row, actually it
uses 800 clock periods of which 640 are used to scan the pixels which can be
seen on the screen. The remaining 160 clock periods are used to retrace back
(moving the CRT from the end of the row to the beginning) and also the
synchronization. A similar process applies to the vertical synchronization,
which uses 525 instead of 480 horizontal synchronization pulses. So the screen
refresh frequency is typically 60 Hz.
Fortunately the clock frequency of
the UP1 board used is the same as the VGA operating frequency. So if in 800*525
clock periods, we send 640*480 signals, including RGB, i.e., a 640*480 8-color
picture data, we can get a steady display of that picture. However, the picture
which can be displayed is limited to 8-color only, because 3 bits – R, G, B are
used to represent the color and each bit can only have two states – 0 and 1.
Therefore there is a big problem: 8-color (3 bits) is too less to display a
natural picture which is generally 16-bit or higher (24-bit for true color) per
pixel.
The solution of the problem is
similar to develop a VGA display driver which can display 64 colors on the
screen. In theory, if we can expand the 1-bit RGB to 2-bit RGB state, we can
have a display of 26=64 available colors. The following scheme is
the trick used to have a virtual 2 bit RGB state:
value |
R or G or B |
||||
00 |
01 |
10 |
11 |
||
Counter |
00 |
0 |
0 |
0 |
1 |
01 |
0 |
0 |
1 |
1 |
|
10 |
0 |
1 |
1 |
1 |
The following table lists the
comparison of screen display performance for different parameters used:
fh-synch (unit:clock period) |
f-synch (unit:horizontal synchronization pulse) |
Refresh Rate |
Screen Flicking |
800 |
525 |
60 |
very heavily |
700 |
451 |
80 |
heavily |
600 |
373 |
112 |
slightly |
560 |
357 |
126 |
acceptable |
500 |
271 |
186 |
stable |
(1) Obviously the trick used in this method to display more
than 8-color can only be used to display patterns smaller than about 400*200 pixels,
if we want to have a stable display.
(2) Because of the different properties of display monitor,
some monitors can not accept refresh rate higher than a certain value. This
experiment results were obtained on a Panasonic PanaSync E70i type monitor.
vga_test.vhd, syncgen.vhd, RGB_gen.vhd, clock_rgb.vhd