Friday, June 7, 2013

Pexeso Game with C - PIC16F877

Detailed specifications of the game
Input
The input is taking from the keypad matrix based on PORTB by pressing on
1
2
Move Up
3
4
Move Left
5
Flip
6
Move Right
7
8
Move Down
9
*
Start new game
0
#
Quit

Output
The output can appear on (4x20) LCD based on PORTD & PORTC.
·         There is a screen for loading the game.
·         There is a selection frame to move on folded cards.
·         All cards have a question mark shape.
·         Having 20 different shapes to use.
·         There is a score count updates every time you get a score.
·         There is a clicks count updates every time you click on any card.
·         UI is some kind good and well organized.
Game Logic
These points are be handled
·         Cursor is moving to anywhere in LCD with the above instructions.
·         Selection frame is moving on fold cards and when flipping the shape must be appeared.
·         Able to compare upon selecting two – More than two is not a LOGIC.
·         When flip a folded card and flip it again, it turns to questions mark shape again.
·         When selecting two cards and they are not matches, they will be a question mark shape again.
·         When selecting two cards and they are matches, their cells will be empty.
·         At any time when pressing ‘*’, it will start a new game.
·         At any time when pressing ‘#’, it will quit the game.

Description of the implementation
  • Using only 0x00 to optimize the memory usage.
  • Using only unsigned integer 8 bit (uint8_t).
  • Implementing the LCD as points (x, y). So the game 20*2 means that the first row from point (0, 0) to (0, 19) and the second row from (1, 0) to (1, 19).
  • The code is well organized, divided into H files, commented.
  • Small memory use without using any extra memory.

Program Properties



List of the used resources
·         Laptop with windows platform.
·         MPLAB X IDE v1.70 for developing.
·         PIC Simulator IDE for simulating PIC16F877 microcontroller.
o   Keypad Matrix
o   4*20 LCD
·         PIC C Language.
Keypad Matrix configuration


LCD (4*20) configurations


Screenshots from the game:






Download Code here.

No comments:

Post a Comment