Reply by Tim Wescott December 3, 20152015-12-03
On Mon, 30 Nov 2015 15:41:43 -0600, empv wrote:

>>Am 30.11.2015 um 19:45 schrieb empv: >>> 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. >> >>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). > > There's something I can do?
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
Reply by Robert Baer December 3, 20152015-12-03
Hans-Bernhard Br�ker wrote:
> Am 30.11.2015 um 19:45 schrieb empv: >> 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. > > 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). >
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 by c4urs11 November 30, 20152015-11-30
On Mon, 30 Nov 2015 12:45:26 -0600, empv wrote:

> Can I do something with that hex result in the display
You may find inspiration here: http://www.codinghelmet.com/?path=exercises/converting-number-bases Cheers!
Reply by empv November 30, 20152015-11-30
>Am 30.11.2015 um 19:45 schrieb empv: >> 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. > >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).
There's something I can do? --------------------------------------- Posted through http://www.EmbeddedRelated.com
Reply by Hans-Bernhard Bröker November 30, 20152015-11-30
Am 30.11.2015 um 19:45 schrieb empv:
> 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.
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 by empv November 30, 20152015-11-30
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 http://www.EmbeddedRelated.com