/* Converts a 2 digit decimal to BCD format.  */
static uint8_t RTC_ByteConBcd2(uint8_t val)
/* Converts a 2 digit decimal to BCD format.  */
static uint8_t RTC_ByteConBcd2(uint8_t val)
{
    uint8_t bcdhigh = 0;
    while (val >= 10)
    {
        bcdhigh++;
        val -= 10;
    }
    return ((uint8_t)(bcdhigh << 4) | val);
}