You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. I wrote the attached code
2. worked well the first time
3. but, the next run, the clock loses the hour and seconds
What is the expected output? What do you see instead?
In the library code is wrong
procedure ds1307_init() is
ds1307_write( 0x00 , 0 ) -- Clk halt bit(7):0=ON 1=OFF
ds1307_write( 0x07 , 0b_10010000 ) -- OSC ON
ds1307_write( 0x02 , 0 ) -- 24H mode
end procedure
It should be something like this:
procedure ds1307_init() is
var byte value
ds1307_read( 0x00, value)
ds1307_write( 0x00 , value & 0x7F) -- Clk halt bit(7):0=ON 1=OFF
ds1307_read( 0x02, value)
ds1307_write( 0x02 , value & 0xCF) -- 24H mode bit(6)
ds1307_write( 0x07 , 0b_00000000 ) -- OUT bit(7), SQWE bit(4), RS0=RS1=0 ->Freq
end procedure
Original issue reported on code.google.com by [email protected] on 20 Jul 2011 at 5:43
The text was updated successfully, but these errors were encountered:
This issue was prematurely marked as fixed. The switch in rtc_init() from 12-
to 24-hour mode is incorrect in more than one way.
Temporary fix: when the ds1307 is in 12-hour mode it is switched to 24-hour
mode, but the hour value is left unchanged. So when the switch happens after
midday the clock will be 12 hours off. When the clock is set right after the
_rtc_init() it will remain to work correctly (provided it is not switched back
to 12-hour mode!).
Original comment by robhamerling on 25 Apr 2013 at 8:13
Original issue reported on code.google.com by
[email protected]
on 20 Jul 2011 at 5:43The text was updated successfully, but these errors were encountered: