1. ## 24bit to decimal

i was wondering how can we convert a 24bit binary no. into a decimal no. using a micro this is becase using a mico we can not do the usual way 2^0+2^1+2^2............one way is to divide no. by 10(1010) and keep the remainder. this works for 8bit nos. but i cant figure it out how to use it for 24bitno.

asimov

2. Maybe i did not get the question right but cant u simply shift all the bits into a long itll become a number automatically ( if you are using C )

Maybe you can explain a little more

3. ## 24 bit to decimal

vikas i am using assembly language for a programme running on 8051(at89s51) which has a 24 bit no. (split into 3-8bit no. stored in 3 registerssay r1 r2 and r3). i want to calc the decimal no. cossesponding to the 24bit binary no. formed by cocatinatinating the 3 registers.
now do u get the prob?
asimov

4. Suppose you are going to store the decimal in a 4 byte memory then simply put the registers at the appropate positions in the memory. Now that 4 byte memory is a long which contains the value in decimal.

5. Hi,
can you please elaborate on the problem

6. ## Re: 24bit to decimal

Originally Posted by asimov_18
i was wondering how can we convert a 24bit binary no. into a decimal no. using a micro this is becase using a mico we can not do the usual way 2^0+2^1+2^2............one way is to divide no. by 10(1010) and keep the remainder. this works for 8bit nos. but i cant figure it out how to use it for 24bitno.

asimov
The logic works for any bit number, only the resultant number / string must have sufficient memory allocoted.

idlebrain

7. vikas i am using assembly language for a programme 640-460 exam running on 8051(at89s51) which has a 24 bit no. (split into 3-8bit 70-271 exam no. stored in 3 registerssay r1 r2 and r3). i want to calc the decimal no. cossespondin 646-230 exam g to the 24bit binary no. formed by cocatinatinating the 3 registers.
now do u get the prob?

8. HI there are ways and means of doing this. Infact I had found routine at http://www.8052.com/codelib url for my task, I couldn't find the logic for the routine and that why I had put it in this forum. One way of implemnting this is thru the boots algo...serach the google and you will get plenty of posts for booths algo.

Asimov

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•