This post provides a simple calculator project implementation for PIC12F675 microcontroller. This is a simple one digit[1]Β calculator which implements only 4 functions addition(+), subtraction(-), multiplication(x) and division(/).Β The code for PIC12F675 is written in C language using MPLAB with HI-TECH C compiler. You can download this code from the βDownloadsβΒ section at the bottom of this page.
In this post, it is assumed that you know,
- How to interface keypad with PIC12F675 microcontroller. If you donβt then please readΒ this page.
- How to interface LCD with PIC12F675 microcontroller. If you donβt then please readΒ this page.
The result of the Proteus simulation is shown below.
In the above figure, we can see that a result of β2+2=4β is shown on the screen. To achieve this result, first press β2β from the keypad. Then press β+β and then press β2β again. After that, on pressing β=β from the keypad the result β4β is automatically displayed on the screen.
Features of this calculator
- You can give any single digit input from 0 to 9.
- You can press βON/Cβ button at any time to reset the calculator.
- 4 functions are implemented i-e addition, subtraction,Β multiplicationΒ and division.
- Error messages are displayed if wrong input is detected. For example, if calculator is expecting a number, but a function key is pressed then βWrong Inputβ message is displayed. Similarly, βWrong Functionβ message is displayed if wrong key is pressed instead of a function key.
Main function code
The code for the main function is shown below.
Downloads
The calculator code for PIC12F675 was compiled inΒ MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10.Β To download code andΒ ProteusΒ simulationΒ click here.
For more detail: PIC12F675 based simple calculator ( Code + Proteus simulation )