scdoro
Joined: 12 Jan 2005 Posts: 87
|
02 Jun 2005 3:07 how to convert 26 in binary |
|
|
|
|
Hi all,
I have problem in converting 26 bit binary to BCD using PIC 16F782 using assembly language.
I need to convert eg 2FAF080 hex to 50 000 000 dec using 4 registers casade together..
which mean 4 bytes. actually my application is to make use of timer0 as a counter to count the input freqency and store them in a 4 byte register.. then convert to BCD to be display on lcd, it may be any value up to 50M,
Can anyone pls help me on that ?
thanks a lot
|
|
whorse
Joined: 04 Mar 2002 Posts: 74 Helped: 1
|
02 Jun 2005 9:55 bcd routine in c |
|
|
|
|
A DEC number is expressed as
Dn*10^n+...D2*10^2+D1*10^1+D0*10^0
divide the hex number with 10, the remainder is D0, then use 10 to divide the quotient again, the new remainder is D1, repeat this process, until you get all the digit. It's quite easy to implement this in C, you can write a C function, then research the assembly result.
|
|