Basic Arduino VGA

Basic VGA Theory
           The theory of VGA relies upon being able to successfully display the color data, then horizontal synchronize and vertical synchronize, all at specific times that cannot be missed.
           The Arduino UNO runs off of a 16 MHz crystal oscillator and since it runs 1 clock cycle per instruction that means that each executed assembly instruction of our program will take exactly (1 / 16,000,000) of a second or about 62.5 nanoseconds.



           Since each instruction is executing at 62.5 nanoseconds and we need to synchronize at certain times, its important that each of the times in the chart seen above are divisble by 62.5 nanoseconds because that means we can use delay instructions to get perfect timing for the synchronization signals seen below.



           When using 800x600 VGA, every line ends with a horizontal synchronization pulse that tells the monitor data for the next line is coming soon. After 601 of these line synchronizations, the monitor expects to see a vertical synchronization pulse for the period of 4 lines. Then there's a pause for the length of 23 lines. Through this vertical synchronization and 'back porch' pauses, the line synchronizations are still firing but no color data is used.