Professional Documents
Culture Documents
Scoring Details
Milestone Score Week
Startup 1 1
Write EEPROM 5 1
Write done display 1 1
Read EEPROM 8 1
Word Select (for Game mode) 1 2
Parsing 5 2
Time Remaining (in Game mode) 4 2
Scrolling Letters 6 3
Incorrect Letters 6 3
Correct Letters 6 3
LED blink 3 3
Game End 1 3
No EEPROM 3 3
You are to create a “Word Guessing Game” whose words to be used are stored in an external EEPROM. Each
word should be 4 to 10 letters long. Each word should start at every 16 th byte place in memory while each
letter should occupy one byte of memory. Letters A to Z should be encoded as 0x01 to 0x1A. Unoccupied
memory locations should contain 0x00. Refer to the example below (all addresses and data are in
hexadecimal).
Address LSB 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Data 05 18 01 0D 10 0C 05 00 00 00 00 00 00 00 00 00
Letter E X A M P L E - - - - - - - - -
Address LSB 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
Data 12 05 0E 04 05 1A 16 0F 15 13 00 00 00 00 00 00
Letter R E N D E Z V O U S - - - - - -
(always 00)
Startup
At startup, your program should prompt the user which mode to use. At this state, your system should only
be responsive to the reset button and keypad (1-4). Pressing the corresponding keypad buttons changes the
state into the following modes: (W) Write Mode, (R) Read Mode, (P) Parse Mode, and (G) Game mode. The
number on the right hand side will be explained on the Game Mode portion of this document. [1 point]
Write Mode
Your PIC24 microcontroller should write 64 unique words to the lowest memory addresses in the EEPROM.
While the write is processing, your LCD should display the message below and the red LED should light up.
Your system should only be responsive to the reset button while in this mode. [5 points but prerequisite is
read mode]
Restrictions: See table on the next page regarding the number of unique letter per word.
After the writing is done, turn off the LED and then display the message below. Pressing the push button
should put your system back to the Startup state. [1 point]
Read Mode
The read mode should display the contents of the EEEPROM through the LCD. The display should include the
word number based on the address at which the word is saved. Two words should be displayed at a time.
Moving the first potentiometer should scroll the display from the first and second words, up to the second to
the last and last words. Each state of the display should be properly distributed over the full potentiometer
range. [8 points]
Parse Mode
[5 points] The parse mode should display how the words in the EEPROM will be initially displayed during the
game. Similar to the one shown below:
There will be a set of rules to be followed when determining which letters to be displayed. First, the number
of given free uncovered unique letters must follow the table below. Let N be the length of the word and let
X, Y, and Z be the values for the first second and third letters. Uncover the letter at the n 1th place, and all
places with the same letter, where n 1 = mod(X, N)+1. Then, uncover the letter at the n 2 th place, and all places
with the same letter, where n 2 = mod(Y, N)+1. If the letter at the n 2th place is already uncovered, then update
n2 as n2 = mod(n2, N)+1. If a third letter needs to be uncovered, then follow the same rules for n2 but use Z in
as the basis instead of Y.
All numbers in the discussion to follow is in decimal. For example, if the word is ELLIPSES, the N = 8, X = 5
(from E), Y = 12 (from L), and Z = 12 (from L). Since N = 8, there should be 3 uncovered letters. From X, we
get n1 = mod(5,8)+1 = 6 and therefore we should uncover the letter at the 6 th place which is S. From Y, we
get n2 = mod(12,8)+1 = 5 and therefore we should uncover the letter at the 5 th place which is P. From Z, we
get n3 = mod(12,8)+1 = 5 and therefore we should uncover the letter at the 5 th place. However, P is already
uncovered and we update n 3 to 6. However the letter at the 6th place is already uncovered. Therefore, we
update again n3 to 7 and uncover the letter at the 7th place which is E.
Similar how the Read mode worked, the first potentiometer should also be able to control which word is
displayed in Parse mode.
Game Mode
In Game mode, the LCD displays follows the format below. The word to be guessed at its current state, with
all the correctly guessed letters already uncovered, must occupy the upper left side of the display. This
portion of the display will be referred as the “word state” display. The upper right portion of the display
should display the “scrolling letters” with the cursor at the middle letter. The portion at the lower right
should contain the “incorrect letters.” The portion on the lower left should contain the “time remaining.”
(Note that in the second example, the P is already replaced by a dash line since it is a given or is already
“guessed” by default.)
Gameplay
Before the start of game, at startup mode, a second potentiometer must be used to control which word
(word address) should be used for the game. The full range of the potentiometer must correspond to the
maximum number of words in the EEPROM and be displayed on the lower right portion of the display at
startup. Once the game has started any changes on this potentiometer should not affect the currently
running game. The potentiometer stated must only be used for word select. [1 point]
The player guesses that a letter is part of the word by selecting the lette r using the potentiometer and then
pressing the button. If the guess is correct, then all occurrences of the letter should appear on the “word
state” [6 points]. If the guess is incorrect, then the letter should be displayed on the “incorrect letter”
portion. The letter should then appear as “-“ in the scrolling letters display.
Pressing the button while the selected “letter” is a “-“ should do nothing.
The display should look like the one below if
the word is “ELLIPSES” and
the letters L, F, and J have been entered as guesses
the current selected letter is K
The player is only allowed up to three incorrect guesses. Depending on the number of incorrect guesses, the
LED should toggle between ON and OFF. The toggling of the LED should continue as long as the game is not
finished. [3 points]
If the player makes 4 incorrect guesses, then for 3 seconds, the LED must be turned and remain ON while the
LCD displays “YOU LOSE!” at the middle of the LCD. At this state, the system should not respond to any input
other than the reset button. After three seconds, the LED turns off the system goes back to Startup mode.
[0.5 point]
If the player guesses correctly all the letters of the word, then the LED is turned off and for three seconds,
the LCD should display “YOU WIN!” at the middle. At this state, the system should not respond to any input
other than the reset button. After three seconds, the system goes back to Startup mode. [0.5 point]
Special Case
When any mode from startup is chosen and the EEPROM is not connected, the LCD should display “EEPROM
not detected!” and lights up the LED. Pressing the push button returns the state to startup. [3 points]