For our final project, we used an Atmel AT90S8535 microprocessor to create a hangman game. The letters are displayed on a 16-character LCD, and are input (“guessed”) using a 16-button keypad. The 8 LED’s on the Atmel development board are used as our “hanging man” – one lights up for each wrong guess. We also attached a speaker to our game which adds sounds to our game.
We programmed our game to randomly select from among nearly 150 different puzzles, although there is enough room in Program Memory to hold thousands of puzzles. A puzzle can consist of any combination of 1-15 characters including spaces.
Our design incorporated many different parts of previous labs as well as original code. The following state descriptions outline the functions of our game.
At reset, we initialize the three counters and the LCD. The LCD initialization and control code is the same as that used in previous labs.
State 0: Wait for “New Game”
Our code then goes into a keyboard polling loop that waits for a button press from the keypad. The keypad decoding is handled by the same code used in previous labs to decode button presses. The only valid button press at this time is a ‘1’ which is the signal to start a new game. All other key presses leave the game in state 0.


State 1: Read in a Random Puzzle from Program Memory
Due to the vast amount of storage available in Program Memory (8 kilobytes) and the compact size of our code(~1 kilobyte), we chose to store our puzzles in   Program Memory. They begin with the label “message:” and consist of a series of ASCII characters (1 byte per character). Puzzles are seperated by a terminating zero (0).
For more detail: Hangman!

Related Post

Be the first to comment

Leave a Reply

Your email address will not be published.


= 5 + 4

Read previous post:
Programming the Game Simon

Introduction Many of the simpler electronic games of the past decade can be easily programmed on the AVR microcontrollers we...