Discussion in "Project Addition or Changes" started by    engr1931    Nov 19, 2014.
Wed Nov 19 2014, 05:03 pm
#1
sir can i ask help in adding more number digits that can be solved because this current code only has 2 digits. he made this but my project needs 5 digits. i tried add but i have problem moving data to other register.. can i please have your help. thank you. ill add attachment of the code i found in net.


[ Edited Wed Nov 19 2014, 05:04 pm ]
Wed Nov 19 2014, 05:06 pm
#2
I am not able to see any attachments. Please zip your files and then attach.
Wed Nov 19 2014, 05:15 pm
#3
this one sir! i attached the whole project!
Wed Nov 26 2014, 10:03 am
#4
Are you bound to use assembly? if yes then there will be good amount of work in all respect. 5 digit means you are dealing with a 16-bit variables and there will be change in all function that do addition subtraction etc... even for reading characters you need to modify all the code. If you are allowed to use C language then you're life is easy.
Thu Nov 27 2014, 10:48 am
#5
yes sir! i only know assembly, and still in process of learning C programming for 8051.
can you give me example of C program that will be useful for the project sir. with some explaination/idea or maybe some tutorial for C programming sir. Thank you
Fri Nov 28 2014, 09:59 am
#6
If you have worked on normal C language then Embedded C is no different unless you're dealing with something that is related to hardware. Here in this case you only deal with LCD and keypad rest everything is C programming.
/* Adding two variables is as simple as this */
result = a + b;
/* multiply */
result = a * b;
/* and so on... */


Now comes to displaying those results on LCD. I assume you use a LCD driver (e.g. http://www.8051projects.net/lcd-interfacing/) which can take string to print on LCD. So prepare buffer and then print it.

/* put result in a buffer */
char buffer[20];
snprintf(buffer, 20, "%d", result);
/* Now print it */
LCD_String(buffer); /* some function like this */


You can take reference from projects where keypad and LCDs are used... e.g. door lock project etc. You can also look at the keypad tutorial and directly use that code; Here: http://www.8051projects.net/keypad-interfacing/
Wed Dec 17 2014, 01:39 pm
#7
Thank you sir for help!

I did change the code sir in readInput part, now i can input 4 to 5 digits and it give correct result in 3 input. but when i try input 4 digit and multiply it by 2 digit number it gives wrong output!
Thu Dec 18 2014, 03:23 am
#8


Thank you sir for help!
I did change the code sir in readInput part, now i can input 4 to 5 digits and it give correct result in 3 input. but when i try input 4 digit and multiply it by 2 digit number it gives wrong output!

engr1931


You will need to post your latest code before we can give
much help.

One point is that a 16 bit variable can only hold results up to 65,000
Are you using big enough variables ?


Mon Dec 29 2014, 10:59 am
#9
this is the edited code sir.
i can sir. i want big results sir, can i ask for C code of calculator sir. i really nid it for project sir.
Tue Dec 30 2014, 12:10 am
#10
The code in "mycalculator.rar" is in assembly language
and does not assemble due to problems with jumps and
label names.
what code did you get working with 4 digit inputs ?

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am