PIC Single Chip 8x8 R/G Race Car Game

Thread Starter

MMcLaren

Joined Feb 14, 2010
859
After coming across RetroBrad's 8x8 Great Race game recently, I couldn't imagine that 64 pixels on an 8x8 red/green LED matrix would be enough for a useful game. The video on Brad's site looked interesting and when I saw the simple circuit design, basically a 16F628A, a 7442, and a few other parts, I thought it might be fun to build it and check it out for myself. I'm glad I did.

Even though Brad's hardware design was pretty simple, I didn't have a 7442 IC and the 8x8 red/green display I had was common cathode row instead of common anode row. Since I was hoping to save money by using parts on hand, my solution was to redesign the game hardware using a single 20-pin PIC instead of Brad's original 16F628A + 7442 combination, and to rewrite Brad's assembly language game program. I'm happy to share those results here, with Brad's kind permission, of course.



Hardware

I used a 16F1828 microcontroller but you could also use a 16F690, an 18F14K22, or just about any other 20-pin PIC with only slight modifications to the game program. The project was built on a small Radio Shack prototype board. I used a pair of machined pin SIL (single inline) sockets for the display which leaves plenty of room underneath the display for the 16F1828 microcontroller, which is also socketed. I'm using "direct drive" from the PIC I/O pins to the display and I rely on the ~200-250 ohm RDS(ON) resistance of the I/O pin MOSFET drivers for LED current limiting. I refresh the display one LED at a time for even brightness across the display and this also reduces the LED duty cycle and overall display brightness as well as power consumption.



The 8x8 display is the tricky part. It needs to be positioned 90° clockwise on the pcb (pin 1 on the display will be at the top left corner of the display). I didn't include display pin numbers on the wiring diagram because there are probably several different CC 8x8 RG displays to choose from, including a couple at Sparkfun. I'm actually using just the Red and Green portions of an RGB display on this prototype.

To figure out the pin numbers for the display you're using, take the schematic from the datasheet for the display and turn it clockwise 90°. You should be able to match the correct display pin numbers and copy them onto the wiring diagram. If you're unsure, post a link to the datasheet for the display you're considering and we'll try to help you with the pin numbers.

Parts List

Rich (BB code):
1 ea. PIC16F1828-I/P (DIP package)
1 ea. 0.1-uf (100nf) ceramic capacitor
1 ea. 10 kOhm, 1/8th watt carbon film resistor
2 ea. 1N914 or 1N4148 silicon switching diode
1 ea. 8x8 Common Cathode Row Red/Green Matrix
2 ea. generic momentary contact switch

Misc. sockets, connectors, prototype circuit board
Software

The HEX file in the ZIP file attachment can be used directly with a PICKIT2, PICKIT3, or similar device programmer to program the PIC16F1828. The assembly language source file is also included in the ZIP file attachment.

The program is a clone of RetroBrad's Great Race game. The 16F1828 is running from the internal oscillator at 4-MHz and the game program logic and the display routines are run inside a simple loop. The display is refreshed one pixel at a time with an overall refresh rate of ~130 Hz.

Operation

Please check out RetroBrad's Great Race page for a description of operation and a nice video. This project differs from Brad's by starting up in a scrolling message mode which displays a "MERRY CHRISTMAS" message over and over again until you press the left push button to start the game.

Have fun.

Cheerful regards, Mike
 

Attachments

Top