Friday, June 7, 2013

Merge Sort with C - PIC16F877


Detailed specifications of the program

Input
The input is taking from the keypad matrix based on PORTB by pressing on
1
2
3
4
5
6
7
8
9
*
0
#

Note:
  • Input 4 numbers (you can change it by changing the array size in the code).
  • To input a number you have to enter it digit by digit then press #

Program starts to enter number 1, when you hit "5" on the keypad now number 1 have "5". To end editing in number 1 hit "#" and it will appear on the screen.


Now you have to enter number 2, hit "6" so number 2 is equal to "6".
Now hit "6" again so number 2 is equal "66" now.
Hit "#" to end editing and it will appear on the screen.


Now you have to enter number 3, hit "1" so number 3 is equal to "1".
Now hit "9" so number 3 is equal "19" now.
Hit "#" to end editing and it will appear on the screen.


Now you have to enter number 4, hit "1" so number 4 is equal to "1".
Hit "#" to end editing and it will appear on the screen.



Output
The output can appear on 7 Segment Display based on PORTD(Data Port) & PORTA(Control Port).
The number will appeared sorted with delay between them.


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.
    • Keypad Matrix
    • 7 Segment Display
  • PIC C Language.

Keypad Matrix configuration



7 Segment Display configuration


Download code here.

No comments:

Post a Comment