MSP430 Calculator with keypad and LCD

I am working on a calculator that can add, subtract, multiply and divide in any base between 2 and 16 with MSP430g2553 in assembly language. I already can do this in any base but the problem is that the results of any of the operations is in hexadecimal in the registers. I need to display the result in the base entered by the user in the LCD. To display in the LCD I need to send the ascii codes of each digit to the LCD. For example I am adding 77(base 8) + 4(base 8) = 103 (base 8), but my result is stored as 43(hex) because 103(base 8) is 43(hex). Can I do something with that hex result in the display it in the desired base in the LCD?

--------------------------------------- Posted through

formatting link

Reply to
empv
Loading thread data ...

Am 30.11.2015 um 19:45 schrieb empv:

Not, that's not your problem, because there is no such thing as a "hexadecimal in the registers". Hexadecimal, decimal, etc. are properties of external representations of numbers (e.g. in printed output or on a display), but never of register (nor, for that matter, numeric variables in memory).

Reply to
Hans-Bernhard Bröker

divide

There's something I can do?

--------------------------------------- Posted through

formatting link

Reply to
empv

You may find inspiration here:

formatting link

Cheers!

Reply to
c4urs11

Check; it is all ones and zeros, which we can interpret as we see fit: Octal, Hex, and Binary. The ones and zeros do not shuffle around according to our narrow-minded prejudices.

Reply to
Robert Baer

Stay awake in class? I assume this is for a school project -- your wording has "homework" written all over it.

Do a web search on "base conversion algorithms" and see if that gets you something. You want a document that tells you how to convert a number in one base into a number in another.

That should get you digits in whatever base you need -- getting those digits to the display will be your next task, and one that, hopefully, is obvious.

--
Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.