views:

812

answers:

2

I'm attempting to create a generic graphics controller for VGA monitors with an Altera FPGA via a VGA connector, but I cannot find any good online resources explaining the standard specification which monitors use. I've found all the pin descriptions and some resources which describe how to create a specific graphics controller, such as this 8 colour 480x640 controller, but no resources I've found describe the actual expected 'protocol' which monitors.

For example, nowhere have I found what the exact timings are supposed to be between different parts of the signal -- in the above, specific timings in µs are given but not why. Are all the sections supposed to be in these set proportions or is there some arbitrariness with regards to pause timings between rows, etc.... What would the pseudo-code look like if you were thinking of implementing it in code (and be able to change resolution / colour depth)?

Again, I'm looking for the expected 'protocol' for a generic controller -- similar to what an OS would use when no monitor type is specified. An pointers to the right direction would be appreciated.

+2  A: 

I haven't done any lower level VGA stuff for years, but a book I used that that may be of some help is: Programmer's Guide to the EGA, VGA, and Super VGA Cards

The table of contents for the book is as follows:

  1. Introduction to the Programmer's Guide
  2. The EGA, VGA, and Super VGA Features
  3. Graphics Hardware and Software
  4. Types of Graphics Systems
  5. Principles of Computer Graphics
  6. Alphanumeric Processing
  7. Graphics Processing
  8. Color Palette and Color Registers
  9. Reading the State of the EGA and VGA
  10. The EGA/VGA Registers
  11. The EGA/VGA BIOS
  12. Programming Examples
  13. The Super VGA
  14. Graphics Coprocessors
  15. Super VGA Code Basics
  16. The Adapter Interface
  17. The 8514/A
  18. The XGA
  19. ATI Technologies
  20. Chips and Technologies
  21. Cirrus Logic
  22. The Video7 Super VGA Chip Set
  23. IIT
  24. NCR
  25. Oak
  26. S3 Incorporated
  27. The Trident Super VGA Chip Sets
  28. The Tseng Labs Super VGA Chips
  29. The Paradise Super VGA Chips
  30. Weitek
Ash
+1  A: 

This site: http://server.oersted.dtu.dk/www/sn/31002/?Materials/vga/main.html

Has a pretty good discussion on VGA.

The key to what you're asking is answered with this clip from the site: http://web.mit.edu/6.111/www/s2004/NEWKIT/vga.shtml

"As with RS-232, the standard for VGA video is that there are lots of standards. Every manufacturer seems to list different timings in the manuals for their monitors. The values given in the table above are not particularly critical. On a CRT monitor, the lengths of the front and back porches control the position of the image on the display. If the image appears offset to the right or left, or up or down, try adjusting the front and back porch values for the corresponding direction (or use the image position adjustments on the monitor, which accomplish the same thing)."

The problem is backwards compatability doesn lend itself well to a simple equation to determine these values. There is a modern spreadsheet that will calculate values for monitors that use the most recent standards, but if your playing around with VGA the old analog monitors will let you do tricks that you can't do on an led type display.

Your resolution is limited to how fast the electronics can turn on and off the electron beam, but the horizonal placement is only limited by your clock and what ever phase adjustments are possible on your FPGA.

For instance you can setup 640x480 timing on your sync pulses and instead of clocking data at 25MHz you can use 100 or 200 MHz and simply require a min on time for each pixel. Effectively allowing you to smooth scroll 1/8th of the width of a pixel. You may be able to do simalar tweeking to the distance between scan line although I've never tried it.

NoMoreZealots