News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Positron8 - DS1302 RTC Library - bug spotted

Started by trastikata, Aug 07, 2023, 07:46 PM

Previous topic - Next topic

trastikata

Hello Les,

thank you for the excellent library, really saved me some time going through datasheet and coding.

Positron8 - DS1302 RTC Library

However, I spotted a bug that needs fixing. When the hour gets to the 20th, the library returns 00,01,02,03 because the masking of the RTC_bHour for BCD conversion is missing the 5th bit:

QuoteDim RTC_bHour     As Byte                                  ' Holds the Hour value (0 to 23)
RTC_bHour = DS1302_BCDToDec(RTC_bHour& %00011111)          ' Convert the masked BCD value to a decimal value

should be:

QuoteRTC_bHour = DS1302_BCDToDec(RTC_bHour& %00111111)

Regards.

BUG.jpg