High Level Design:
The physical components of our project involve the board that we built to support the Atmel MEGA32 Microcontroller, the video game controller that sends the user’s inputs to the MCU and the video and audio signals that the microcontroller outputs to a television. The video game controller has three buttons that each send a signal to the microcontroller. The signals are high when the buttons are raised and each signal drops to ground when the appropriate button is pressed. The Microcontroller then outputs a sync signal and a video signal which are turned into an NTSC signal through some simple analog circuitry (see Hardware Design). The microcontroller also sends out an audio signal to produce the sound for the game.
Most of the work for the project is in the state machine that controls the game. The microcontroller outputs the NTSC video signal and between lines 231 and 262 our state machine runs. A more detailed explanation of the software can be found in the Program Design section, but the basics of the state machine are as follows:
Setup: Draws the current hole onto the TV screen and then goes to input1.
Input1: Takes the angle input from the user (from the counterclockwise and clockwise buttons on the controller) and goes to input2 when the shoot button is pressed.
Input2: Takes the power reading from the user (determined by the position of the power meter when the shoot button is released) and then goes to the rolling state.
Rolling: Updates the position of the ball, slows the ball down as it rolls and bounces off of obstacles appropriately. Goes back to the input1 state for the next shot if the ball stops, goes to the finish state if the ball goes in the hole.
Finish: Prints “Good Job” once the user finishes the hole, goes to the delete state when shoot is pressed.
Delete: Deletes the current hole off of the screen and goes to the setup state to draw the next hole unless it is the 9th hole of the course and then it goes to the scorecard state to display the scores for the round.
Scorecard: Displays a scorecard with all of the data from the previous round. When the shoot button is pressed the machine goes back to the setup state and starts over at hole 1.
Miniature golf games are fairly common on the computer and both of us have seen many of them. However, we kept our ideas original and did not take any specific information from any previous games that we had played. We used the video generation code that was given to use in Lab 4 (TV oscilloscope) and modified it to create our video signal. The NTSC video standard was the one standard that we used in our project. Other than that all of our code and algorithms were original and we developed them as we went.