1. ecka333

    Thread Starter Active Member

    Oct 1, 2009
    76
    0
    Hello, i have question about real time clock DS1307. In datasheet i read that all time and data bytes is coded in bcd format. So i want, for example to read seconds to microcontroller and display on LCD. According datasheets, byte of seconds is:
    bit7: ch
    bit6-4: 10 seconds
    bit3-0: seconds.

    So i read seconds byte to microcontroller. Next i must to convert readed value from bcd to decimal. I dont know how to do this. Must i split readed 8 bit bcd value to bcdHigh and bcdLow 4 bit values and then convert them separately each to decimal values. Or i must read eight bit bcd value, and simply convert it to eight bit decimal value?
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    BCD is Binary Coded Decimal.
     
Loading...