The post provides a simple calculator project code using assembly for 8051 micro-controller. This is a simple one decimal digit calculator which implements only 4 functions: addition(+), subtraction(-), multiplication(x) and division(/).
Code, flowchart and Proteus simulation 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 8051 micro-controller.
The result of the Proteus simulation is shown below.
In the above figure, we can see that a result of "9x9=81" is shown on the screen. To achieve this result, first press '9' from the keypad. Then press 'x' and then press '9' again. After that, on pressing '=' from the keypad the result '81' is automatically displayed on the screen. Then after seconds the screen cleared automatically for next try.
Flowchart
The flowchart describes the main routine and each one of the four subroutines included at the assembly code.
the program acts as follows:
- Initialize the memory and LCD for display after powering up.
- Get input form user as " 10/2="
- Calculate the result depending on the operation once the user press (=)
- Print the output on LCD
Features of this calculator
- You can give any single digit input from 0 to 9.
- 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 , flowchart and proteus simulation click here
thats realy great
ReplyDeleteYour post was very informative thank you for that
ReplyDeleteIf some one wishes to be updated with latest technologies after that
ReplyDeletehe must be go to see this website and be up to date everyday.
why i cant use it with two digits? i need that one
ReplyDeleteThanks :)
ReplyDeleteI hope you found it useful. If you still interested with 8051 assembly, keep checking my blog weekly. More applications are being posted ^_^
ReplyDeleteThat's why I called it basic, however it's so simple to be reconfigured to deal with two digits. Few lines have to be added to "Read Input" subroutine. Try to develop it by yourself. If it doesn't work, post me again and I send you it.
ReplyDeletePretty nice post. I simply stumbled upon your blog and wanted to say that I've truly enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I'm hoping you write again very soon!
ReplyDeleteHi there, I discovered your site by means of Google whilst looking for a related matter, your site got here up, it seems to be great. I have bookmarked it in my google bookmarks.
ReplyDeletecould you explain me how to modify to make a two digit calculator
ReplyDeleteHi!, great project!!!. One question, I enter a two-digit number shoot me wrong. For example I want to do (10/2) and shows me an error screen. I read your comment above and I’m trying to modify it, but I can not, recently I started in programming. You will have the code so you can study it and understand it well?
ReplyDeleteSorry my bad English. Greetings!
[…] 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 […]
ReplyDeleteI just posted it.. kindly check out this http://wp.me/p2dNDl-7e :)
ReplyDeleteThat's because it was one digit version. Later I developed another one could handle 2 digits calculations to do perfectly what you asked for. I hope it help you with learning assembly programming. http://wp.me/p2dNDl-7e
ReplyDeletehere it is http://wp.me/p2dNDl-7e :)
ReplyDeletethanks bro .... i will learn it more
ReplyDeletecan you help me once more ?
my task is coding for 16 bit calculator with 7 segment
please give me your help
OK, with pleasure bro :)
ReplyDeleteIt's easy to interface the calculator with 7 segments to show results, no problem in that, but which do you mean with 16 bits? entered numbers or the results?
result bro ,,
ReplyDeleteonly adder calculator
thanks bro ... i'm waiting for
i executed it in topview simulator but 50 errors are shown please solve those.....
ReplyDelete