Quantcast
Channel: Wardy's Projects
Viewing all articles
Browse latest Browse all 70

VGA - FPGA - VHDL and other assorted acronyms!

$
0
0
Not since I started playing with the Parallax Propeller microcontroller last year have I found such a goldmine of hacking potential as with FPGAs.

My latest challenge has been to display a clear and coherent signal on my TV set using VGA signalling.  Up to now I have had varying levels of success in persuading a Propeller chip to display exactly what I wanted on an VGA screen.  That's not a criticism of the Propeller (heavens forbid!) but more of my own PASM programming.  I found that trying to coax the Prop into drawing pretty pictures was an exercise in pain and capitulation.  Painful in that you have to jump through many obscure hoops and in the end you end up just using a code sample off the internet written by Our Corporeal Lord, the Highly Venerable Sir Chip Gracey, Esquire.

With FPGAs, there's none of that diabolical faffing around.  You can just use some really clear (compared to assembly language) and human-readable code to describe the signals you're trying to generate and that gets encoded into a stream of configuration bits which then is fed into the FPGA device and suddenly you've got a nice neat signal on your VGA screen.  The ease with which this amazing feat can be performed is very surprising.  All it takes is a few days of keen study in the art of VHDL design (there's plenty of entry level info on the internet, naturally) and then some quick (read: prolonged and frustrated*) research into how VGA signalling works and you've got all the tools you need to write the code to make an FPGA generate video signals.

Here's my first attempt at a half-decently written VGA code module in VHDL...

VGA.vhd source code

The test pattern is merely a 800x600 pixel display (2 bits per R,G,B channel) showing a full white background and a 2x2 red dot in the centre of the image.  My LCD TV shows this very stably although there is some fuzziness detectable around the red dot, probably due to some timing issues or perhaps that 800x600 is very much non-optimal for my TV set.  I'll have a play around with other resolutions until I find a really sharp picture and then develop this code further.



----

*A couple of links that VGA-interested people might want to look at are: http://tinyvga.com/vga-timing/800x600@60Hz and http://www.johnloomis.org/altera/DE2/vga.html but take those with a pinch of salt.  My VGA generator wouldn't work unless I used rising edge sync pulses, and it seems that sources of info on that will vary.

Viewing all articles
Browse latest Browse all 70

Trending Articles