Hardware

The hardware we used to implement Pong are NES controllers, a 256x128 LCD screen, a speaker, and a STK500 board with a AT90S8515 microcontroller chip.

The first piece of hardware, the NES controller, wasn't too difficult to implement. Here's how it works. The controller has 7 pins: Vdd, Gnd, Strobe, Clock, D0, and two pins which are unused (figure 1). It has eight buttons: A, B, Select, Start, Up, Down, Left, and Right. Whenever the controller receives a logic high (5V) on the strobe pin, it latches 8 one-bit values into a shift register. Each bit corresponds to one button. If the button is pressed, the bit is pulled to logic low. Every time the Clock bit is toggled, the shift register shifts the values to the left. The first bit in the shift register is outputed to pin D0. As an example, if a player is holding Left and A on the controller, the values in the shift register on Strobe would be 01111101; here D0 outputs 0. The first zero corresponds to A, and the second one to Left. After one Clock cycle, the values would be 11111010; here D0 outputs 1. On the sixth clock cycle, D0 will be 0 again. On the seventh, it will be 1, and every cycle after that it will be zero until the next strobe high. Notice that zeroes are shifted in at the end. We connected Strobe and Clock to PORTB. Both controllers used the same signals. The outputs (D0) of both controllers were connected to PINA.

The second piece of hardware was the LCD display. We used the Hyundai #HG25504NG-01 LCD panel. It has a 5" x 2.75" viewing area and has 256x128 pixels. It has two layers: a text layer and a graphics layer. The documentation described the command set for the LCD. We shamelessly stole the software drivers from a previous project by Nam Darghouth and Kofi Odame. We used PORTD for command codes, and PORTC for control codes. See our Source Code to see how the codes are outputted. We use 5V to power the LCD logic and -10.5V to power the LCD screen.

The speaker was attached to PORTB (it did not conflict with the controllers).

The 8MHz AT90S8515 chip was sufficiently fast to drive all of the devices and to run Pong at a decent speed. See the Software section for more detail on device timing.