# The VGA Test Box: Theory of Operation

How VGA Works
Now that we have gone over the high level understanding of VGA we will delve deeper into the actual timing necessities.

Project Goals:
Resolution: 640x480 pixels (307,200 total pixels)
Field Refresh Rate: 60 Hz
Line Refresh Rate: 31,476 Hz

These numbers can be found in any monitor manual. It is the standard that has been developed so that videocard manufacturers can know how to output video properly to all monitors. Now, how do we apply these numbers to create video with our little microcontroller?

Understanding the above picture is where things get confusing.

Field Refresh Rate = 60 Hz = Screen Refreshed Once every 16.66 ms
Line Refresh Rate = 31,476 Hz = Once every 31.77 uS

31.77 uS * 480 Lines = 15.249 mS as Seen above for the Display.

The extra 1.41 mS is used for the Vertical Sync.
1.41 mS + 15.249 mS = 16.666 mS

Since our microcontroller executes 1 instruction every 1uS we will end up only being able to control 25 distinct spots across each line as data output is 25uS per line. That's all the math & numbers I'll through in for the moment, but that is a more indepth & less high level explaination of VGA signals.

Key Concepts
·Every line gets roughly 25 uS to display data
·The combination of all the lines creates the entire picture on the screen
·The Screen is refreshed once every 16.66 mS, or with a frequency of 60 Hz.

;