Status: Assigned
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 164 by [email protected]: Problem with DS1307 library
http://code.google.com/p/jallib/issues/detail?id=164
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
Attachments:
sample-code-ds1307.jal 2.3 KB
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.