Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/29/06 14:25
Read: times


 
#121311 - BCD manipulation
Responding to: ???'s previous message
Please check out the www.8052.com code library,

http://www.8052.com/codelib.phtml - also there are some examples in this forum group so do a search on the key word BCD conversion.

While some of the examples are in assembly.... the methods can be transported to C.

BCD relates to decimal as each nibble is in base 10 format.... but packed in to nibbles

To convert to base 10....
You might look at dividing the binary number by 1, 10, 100 and looking at the remainder and quotient.

Eg 25 in binary

25/10 = 2 remainder 5,
2/100 = 0 remainder 2

So the remainders can be packed in to BCD byte.

There's probably more on this forum and the web.

JG







List of 5 messages in thread
TopicAuthorDate
binary to bcd and vice versa            01/01/70 00:00      
   No Commands in C but functions            01/01/70 00:00      
      BCD manipulation            01/01/70 00:00      
   please, Please, PLEASE search first!            01/01/70 00:00      
   binary to bcd code            01/01/70 00:00      

Back to Subject List