| ??? 12/17/00 09:35 Read: times |
#7349 - RE: about 32bit hex to bcd convertion |
Hi asghar,
First of all, how can you fit 32 bits into 3 registers ;-) Here is one way to convert hex to BCD. I will explain it for 1 byte numbers, you can expand it yourself to any number you want. Set a counter to 0, subtract 100 from number as often as possible incrementing the counter on every succesfull try, at the end you will have the 100th BCD digit. Set counter to 0 again, subtract 10 from number as often as possible incrementing the counter on every successfull try, at the end you will have the 10th BCD digit. The rest will be the 1th BCD digit. You can make a table in ROM with all constants, so you can do all subtractions with one simple loop. For a 32bit number you need a table like this: 1000000000d 100000000d 10000000d 1000000d 100000d 10000d 1000d 100d 10d |
| Topic | Author | Date |
| about 32bit hex to bcd convertion | 01/01/70 00:00 | |
| RE: about 32bit hex to bcd convertion | 01/01/70 00:00 | |
| RE: about 32bit hex to bcd convertion | 01/01/70 00:00 | |
| RE: about 32bit hex to bcd convertion | 01/01/70 00:00 | |
| RE: about 32bit hex to bcd convertion | 01/01/70 00:00 | |
| RE: about 32bit hex to bcd convertion | 01/01/70 00:00 | |
| RE: about 32bit hex to bcd convertion | 01/01/70 00:00 | |
RE: about 32bit hex to bcd convertion | 01/01/70 00:00 |



