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.

Convert 26 bit binary to BCD Routine

Status
Not open for further replies.

scdoro

Member level 5
Joined
Jan 12, 2005
Messages
87
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,040
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
 

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.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top