How to convert a binary coded decimal number to a decimal number in terms of representation? I do not want to transform its meaning, but rather its representation, that is what I mean.
I want to convert 0x11to decimal 11(not 17) and 0x20to 20(not 32).
unsigned char day = 0x11;
unsigned char month = 0x12;
int dayDecimal, monthDecimal;
I want dayDecimal to be 11monthDecimal = 12. I will work with a range from 0x00 to 0x60, so this should be possible. There will be "A", "B", "C", "D", "E", "F.
Update:
I really read the time from the RTCC chip as part of the embedded project I'm working on. Hours, minutes, day and month are returned in this form. For example, if the minutes are 0x40, then this means 40 minutes, not 64, so I need to be able to interpret it correctly. I need to somehow convert 0x40 to 40, not 64. I hope this is possible.
Thank!
source
share