Close

More Clocks than Flavor Flav

A project log for VGAtonic

CPLD-flavored VGA Video card

pkPK 07/27/2014 at 00:200 Comments

Working on Video isn't particularly hard once you understand the clocks that go into the various technologies, but it's certainly tricky.  A perfect example is NTSC video, which has a few "must hit" frequencies:

3.5795454 MHz (literally, 315/88), the colorburst frequency
30 Frames Per Second (literally, 29.970), the vertical refresh rate
15,734 Lines Per Second, the horizontal refresh rate (originally 15,750 in B&W)

NTSC encodes color using 'chrominance' - think of a color wheel, where the reference color starts as a yellowish greenish sort of hue, and all the colors of the rainbow are shifted around 360 degrees.  Those 360 degrees map to the phase of the clock itself - when you 'paint' a color in NTSC, you really just need to let your 3.5795 MHz reference signal through, phase shifted to represent the actual color you desire.

Here's the breadboard circuit I used to get 4 phases of color when first experimenting with NTSC (just sum phases together with a resistor, or delay them using slow digital logic to get even more):

As an aside (and perhaps as a useful piece of reference for your own video projects) - the phase angle and the horizontal reference rate allow you to determine how accurate your color clock will be if you're somehow synthesizing your color clock and not using a crystal reference.  Figure out how many Hz your clock will drift per line, and divide it by 15,750 to find out the maximum color error from the right side to the left side of the screen.

That drift can be exploited to make an NTSC color tester, actually - a 3.595295 MHz crystal will drift exactly 360 degrees out of phase per row, giving the rainbow of the NTSC color gamut.  And, more relevant to folks also playing with VGA: a (25.175/7) MHz clock will be off by 16,883 and give you a bit more than a rainbow.

Discussions