Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Hexadecimal to decimal Assembly msp430

Status
Not open for further replies.

1996mau

Newbie level 2
Joined
May 23, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
18
Hi, Im looking for a code in order to convert an hexadecimal number "0x0000" to decimal using assembly code.Thanks
 

Hello!

First you should be a bit more specific. Where does this value come from?
You have a value somewhere written in hexadecimal (for example in a text file) and you want the
value of it?

Dora.
 

Hi,

I assume the input is a string representing an unsigned 16 bit value. (But maybe the input is just two bytes binary, that is the same a 4 x 4bit hex nibbles. Clarify this)
"0x" just means that the folowing is HEX coded. It could be used to validate the string.

Now you want a decimal value...in what format?
3 bytes as 6 BCD nibbles?
6 bytes of ASCII string? With or without trailing zeroes?

For 5 x BCD you could do this one:
Subtract (decimal) 10000 as long as the result is not negative.
Count the loops and store the value in the most significantBCD nibble
Then use 1000 and the next BCD nibble
Then use 100
Then use 10
Then store the rest in the least significant BCD nibble.

Klaus
 

Hi,

I assume the input is a string representing an unsigned 16 bit value. (But maybe the input is just two bytes binary, that is the same a 4 x 4bit hex nibbles. Clarify this)
"0x" just means that the folowing is HEX coded. It could be used to validate the string.

Now you want a decimal value...in what format?
3 bytes as 6 BCD nibbles?
6 bytes of ASCII string? With or without trailing zeroes?

For 5 x BCD you could do this one:
Subtract (decimal) 10000 as long as the result is not negative.
Count the loops and store the value in the most significantBCD nibble
Then use 1000 and the next BCD nibble
Then use 100
Then use 10
Then store the rest in the least significant BCD nibble.

Klaus

thanks , Im getting values from the timer , I did a chronometer using timer and my result is in memory and I get for example "0xDEFCBD" and i need to convert that to 14613693 (14.6 seconds aprox), so i need to see "0x14613693" in memory, this is because later I will need to show that value in a LCD display but i have to show it in decimal format.
 

Hi,

In short: Binary to BCD.

But in post#1 there are two bytes input and now there are three bytes input. --> clarify this
It seems the input values are unsigned... --> confirm this

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top