Thursday, June 13, 2013

Basic Calculator V2.0 for 8051

Hello again, after I posted my basic calculator V1.0, I found that many friends and visitors liked it. They also asked if it could be developed to handle 2 digits calculations.

The post provides a simple calculator project code using assembly for 8051 micro-controller. This is a simple up to two decimal digit calculator which implements only 4 functions: addition(+), subtraction(-), multiplication(x) and division(/).

Assembly code, Proteus simulation and Eagle Schematics is given in the ‘Downloads’ section at the bottom of this page. It is assumed that you know how to interface LCD and keypad with AT89C52.

The result of the Proteus simulation is shown below.

Simulation

In the above figure, we can see that a result of “12×12=144” is shown on the screen. To achieve this result, first press ’1' followed by '2' from the keypad. Then press ‘x’ and then press ’12′ again. After that, on pressing ‘=’ from the keypad the result ’144′ is automatically displayed on the screen. Then after seconds the screen cleared automatically for next try.

The schematic with minimum right connections is shown below.

CalculatorV2_Sch

 

Features 

  • You can give any single digit or two digits from 00 to 99.
  • 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 ‘Error!!’ message is displayed. Similarly, ‘Error!!‘ message is displayed if wrong key is pressed instead of a function key.

Downloads

The code was compiled in Kiel uVision 4 and simulation was made in Proteus v7.8 SP2.
To download code , schematics and simulation CLICK HERE