Decimal to BCD conversion
AGCB
Posts: 327
I have a program to reset the clock on an RTC in runtime. The RTC needs BCD (2 places each for minutes, seconds etc) to do a write_page w/ I2C , but the set program puts out straight decimal (2 places). I've looked at various format and string objects but can't see how to make the conversion. Would you please point me in the right direction to solve this.
Thanks
Aaron
Thanks
Aaron
Comments
If you have a two-digit decimal value (i.e. < 100):
-Phil