Hardware Design

The first piece of hardware that was necessary for this project was an oscilloscope. The most common use for an oscilloscope display is to show time on the x-axis and voltage on the y-axis. This is referred to as ‘YT Mode’. Both channels can independently produce a time plot of their channel input signal. Another mode, known as ‘XY Mode’ uses both channels to create a single output on the scope display. The voltage inputted to Channel 1 controls the x-coordinate of the display, and the Channel 2 voltage controls the y-coordinate. This if fixed voltages were being read by each channel, a static dot would be displayed on the screen. If a voltage that varied quickly in time was input, then the result would be perceived as a ‘line’ on the display. It is these quick, time-varying voltages that are manipulated to enable us to create the graphics display for Pong. By adjusting the offset for the display, we created a display windowed by 0-5V on the x-axis, and 0-4V on the y-axis.

To implement the paddles for the pong game, we use two voltage divider circuits with a potentiometer. The output voltage of the voltage divider would vary depending on the resistance value of the potentiometers. We used potentiometers provided on the large prototyping board in the lab; a 10k and 1k potentiometer. The two voltage dividers were designed appropriately to output a voltage range of 0V-3V. The first voltage divider was a 6.6k resistor in series with the 10K potentiometer. At maximum resistance of the potentiometer, the output voltage is 3V, and at zero resistance, the output is 0V. The other voltage divider works identically, using a .66K resistor and a 1K potentiometer. The outputs of these were then inputted into the Analog Port for Analog-to-Digital conversion. These voltages were then used to control the positions of the paddles. In software, the Analog Port is programmed to quickly switch between the two inputs from voltage divider to continually refresh the paddle position desired by each user.

Next, two 8-bit Digital-to-Analog Converters (DAC’s) are used. These DAC’s were created using an R-2R ladder based on 10k resistors. The purpose of these DAC’s was to convert the binary outputs from Ports C and D into an analog signal. These analog signals would then be inputs to the oscilloscope channels. Even though 8 bits are outputted by the ports, the least significant bit was not used in the D-A conversion. This is because the effect of the LSB in the final analog conversion would be negligible due to the known tolerance of the resistors

The buttons and LED’s that we needed were already provided on the STK200 evaluation board. Using jumpers on the board, PORT B could be hardwired to control the LED’s. We only want to use Port B bits 0,1,2,5,6,7 to output to control LED’s 0,1,2,5,6,7. Thus, jumpers for bits 3 and 4 are simply disconnected. When then desired to use Port B bits 3 and 4 to receive inputs from Buttons 3 and 4. Port D is usually hardwired to interact with these buttons via jumpers. We simply wired the appropriate buttons to the Port B pins.