MSP430 Calculator with keypad and LCD

Nov 30, 2015 5 Replies

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



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).

divide

There's something I can do?

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

formatting link

You may find inspiration here:

formatting link

Cheers!

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.

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 http://www.wescottdesign.com

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required