Hangman!

Introduction
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.
Hangman!
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.
Design
Our design incorporated many different parts of previous labs as well as original code. The following state descriptions outline the functions of our game.
Reset:
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.

Hangman!

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!


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top