Here is a fascinating and nostalgic project that kept me up many, many nights last summer (creating it, not playing the game!). I had long thought it would be exciting to try to generate video from a PIC, and with built-in A/D converters available for the paddles, the game of Pong seemed an obvious application to prove the concept.
The most amazing thing about this project is the small number of parts. My boss joked that it involves 17 cents worth of parts and 1000 dollars worth of programming. But don’t worry — the code is free to you! That means you can build this TV pong game in a very short time, or adapt the generic “video engine” portion of the program to make your own video-from-a-PIC project.
At the heart of the circuit is a cute one-transistor driver circuit that generates the NTSC voltages for white (1v), black (.3v) and sync (0v), depending on whether the PIC pin is driven high, low, or allowed to float. With careful programming, I was able to achieve accurate NTSC timings, something most computer and video game outputs do not take the trouble to do. That means you can use this video engine with confidence in broadcast or other applications where correct timings are important.
I call this project VCR Pong because the output signal is actually NTSC composite video, and the most common way to view it is to connect it to the video in jack on a VCR. (How about that old non-HiFi machine that eats tapes? Get it out and have fun with it again!) Naturally any monitor or television capable of directly accepting a video input will work. Or, you can get a ready-made RF modulator and add it for a more traditional approach to Pong.
The code uses the Parallax instruction syntax, so you’ll either need to use Parallax’s SPASM.EXE (available for free on [url=http://www.parallaxinc.com/]Parallax’s web site[/url]) or Tech-Tools’s CVASM16.EXE (available for evaluation on [url=http://www.tech-tools.com/]Tech-Tools’s web site[/url]). You can also download the preassembled object file below, in INXH8M format, for use with any device programmer.
Copyright 1998 [url=http://dt.prohosting.com/pic/]David B. Thomas[/url]Parts:C1-3 .1 uF
C4-5 22 pF (leave off when building in breadboard)
C6 10 uF
Q1 2N4124, 2N2222, 2N3904 or equiv. NPN
R4 75 ohm
R5-6 10K linear taper pots (greater than 20K won’t work)
U1 Microchip PIC16C711 controller
U2 LM340T5 or 7805 5 volt 3 terminal regulator
XT1 16 MHz crystal