To convert Decimal back to BCD, reverse the Process...
RTCSeconds=DecimalSeconds DIG 1
RTCSeconds=RTCSeconds<<4
RTCSeconds=RTCSeconds+(DecimalSeconds DIG 0)
------------------------------------------------------------
Are you sure about that?
I'm trying to convert a 6 digit decimal number into binary and found this thread. If I take 32 for example and manually run it through your code, I get lost.
DECNUM = 32
BINNUM = DECNUM dig 1 : 0000 0011
BINNUM = BINNUM<<4 : 0011 0000
BUNNUM = BINNUM+(DECNUM dig 0) : 0011 0010
But if I use my calculator, 32 = 0010 0000.
I don't see how you can just split the decimal digits and concatenate theM to make a binary number. Or am I missing something in your formula?
Robert "Dazed 'n confused'
![]()
Bookmarks