PIC Game System
This page describes a PIC16F84-based video game system I made and first published back
in the beginning of 1998. Now, beginning of 2007, nine years later I've updated the layout
of the PCB and also updated the source code to also be able to run on a PIC16F628A as
Microchip is phasing out the 16F84 and it will soon not be able to be bought. The final
new "feature" is that you now also can buy PCBs,
preprogrammed chips and of course
complete kits
from me in my web shop.
I have designed the hardware of the PIC video game system to be able to run several different
kinds of games. It has two standard C64/Amiga/Atari joysticks and video and audio output.
The processor is a PIC16F84 running at 12MHz and generates both video (PAL and NTSC) and audio in software.
The description of the hardware is placed on this separate page as it is the same for both
of my PIC-based video games. So far I've only made two games, Pong
and Tetris, but some day there might be more games for the system.
(Most unlikely that I write more games though as I probably will write more games for the
color SX-system instead).
The hardware design
The hardware design is quite simple. The power supply section is just a standard 7805 regulator to get the voltage to 5v, and it has a diode and a cap at the input so it can be fed with both AC and DC (input voltage should be 8..15v something).
Two C64/Amiga/Atari joysticks are used as input for the games. Each joystick has four direction switches (up,down,left,right) and one fire switch. These five switches just short the IO line to ground when moving the joystick around and pressing fire button. This kind of joystick could be connected directly to the IO pins, but it need some resistor nets for protection, I'll get back to why soon.
The video is generated by a two bit DA, using only two resistors and the input impedance of the TV. To be able to get a higher resolution, the software uses PORTB as a shift register. (I got the idea for this from Eric Smith) So that is why the two bits are on different IO-registers. One problem with using one IO register as a shift regster is that one looses a lot of IO-pins by doing this, but I solved this by using 100k pullupps and 1k seral resistors for protection on the remaining IO-pins so they could be used as input pins for the joystick. When the pin is set as an input the voltage in will be 5v thanks to the pullup when the joystick switch is open, and 5v*1k/100k=0.05v when the switch is closed. When the pin is set as an output, the 1k resistor will protect the IO-pin from too high currents during shifting operation when the joystick switch is closed.
The audio has one bit only and is thereby limited to one channel square wave audio. The 1k potensiometer and the 2k7 resistor forms a voltage divider making an adjustable voltage limit of zero to 5*1/(1+2,7)=1,35v assuming the load resistance is much larger than 1k. The audio is only able to drive a line-in input on a TV, amplifier or similar, but not earphones or similar device with low impedance. As the output is only a square wave the audio sounds terrible but the system has sound this way even if it sounds bad ;)
Programming connectors has nothing to do with the operation of the gaming itself so they are left out
in the schematic above, however they are needed if the system shall be able to change game without changing the PIC so my
PCB-layout has two in circuit programming connectors, one 10pin connector, supporting my own
upcomming multiprogrammer, and one 6p supporting microchips programmers such as the
pickit2.
(People that built the system using my old layout should note that I had only a connector for
Jens Madsens programmer in the old
design, so the programming connector has changed for the new layout)
Note that when programming a PIC16F628A in system you will have problems if your PIC has low voltage programming enabled.
This due to that RB4 is pulled up to VDD forcing the PIC into low voltage programming mode which means problems when trying to programming it
in high voltage mode. The simple solution to the problem is simply to push the left joystick to the right (or push right on the left
joypaddle if using layout with built-in joypad) to be able to program it in high voltage programming mode.
To make it easier to build the game system, I've made a building instructions page for this system on how to build it, assuming you are using my PCB layout and the same kind of components. (There is a separate building instruction page for the joypad version of the layout.)
Note that most of the component values in the schematic are not very critical, they may vary at least plusminus ten percent without affecting the system greatly, but with one exception, the chrystal must be exactlyt 12MHz otherwise the video timing gets messed up and you will not get a stable picture.
Joysticks.

A classic Tac2 joystick
The joysticks used for this game is old C64/Amiga/Atari joysticks. I'm using two old Tac2 joysticks. there are probably a lot of these old joysticks out there, but if you don't have access to one, then you could build one using the schematic in the picture below or build the version with built-in joystick described in the further down on this page.

Schematic for a C64 compatible joystick
PCB with built-in joysticks
As it has been requested by several people, now I've created a special version of the PCB with two joypads on the PCB, as seen in the picture here to the right. Both the layout woth the built-in joystick and the standard one (using a C64/Amiga/Atari joystick) are included in the zip-file. The layout supports two common footprints and thus can be used for several types of buttons. There is a separate building instruction page for the joypad version of the layout.



Pictures of three types of buttons supported by the PCB. (Click to enlarge)
Connecting the system to a TV.
You connect the system to a TV by using a composite to scart cable, it is better and cheaper to buy this cable than building it yourself, but if you by some strange reason want to build one then here is a schematic for it:

Schematic for connecting system to a SCART-input.
Download.
The layout is available together with schematics, bill of materials, source-code and hex-files (for both PAL and NTSC and both 16F84 and 16F628A) in the zip files picpong.zip (97kB) and pictetris.zip
Emulators.
If you plan to try generating videosignals with PIC-chips you should try to use an
emulator, makes it much easier. There are poeople that have developed emulators for PIC
processors and have implemented plugins for emulating my hardware:
More info about video signals.
If you want to know more about video signals and about generating video signals in software using PIC's, check out some of these links:
Questions ?
If you have questions about the games, make sure to check out the FAQ (Frequently Asked Questions) before you ask me.
Copyright note
PIC Game System (C) Rickard Gunee. This is open source, use this at your own risk ! You may use the information on this page for your own projects as long as you refer to the original author (by name and link to authors homepage), don't do it for profit and don't hurt or harm anyone or anything with it. The author can not be held responsible for any damage caused by the information on this and related pages.


