@Steve ..apologies .. was actually asking Malc-c about valentines day :-)
@ Steve , regarding these lines :
I understand theseCode:high rst ' Ready for transfer Shiftout IO, SCLK, LSBFIRST, [$bf] ' Read all 8 RTC registers in burst mode Shiftin IO, SCLK, LSBPRE, [rtcsec, rtcmin, rtchr, rtcdate, rtcmonth, rtcday, rtcyear, rtccontrol] low rst ' Reset RTC
LSBFIRST ' MODE 0 - Shift data out lowest bit first. Clock idles low.
LSBPRE ' MODE 0 - Shift data in lowest bit first,Read data before sending clock. Clock idles low.
But what is the [$bf] ?
@Malc-c --to err is human :-)
Kind regards
Dennis
$bf is the register address for clock burst mode read I believe.
Do a search for $bf in the ds1302 data sheet.
steve
Yes had just checked data sheet just after I posted !
$bf is for burst mode :-)
Thanks to all who replied .. this is making a whole lot more sense now :-)
Kind regards
Dennis
@ Steve ...
Do you have a snippet for the write in burst mode so one can set the clock ?
Kind regards
Dennis
Sure, this should do it:
steveCode:settime: ' Subroutine to write time to RTC RST = 1 ' Ready for transfer Shiftout IO, SCLK, LSBFIRST, [$8e, 0] ' Enable write RST = 0 ' Reset RTC RST = 1 ' Ready for transfer ' Write all 8 RTC registers in burst mode Shiftout IO, SCLK, LSBFIRST, [$be, rtcsec, rtcmin, rtchr, rtcdate, rtcmonth, rtcday, rtcyear, 0] rst = 0 Return
@Steve
My code before you replied ...
As you can see I was totally off the mark with the $bf , $be setting !Code:setclk: high rst ' Ready for transfer RTC pin must go high Shiftout ds_data, ds_clk, LSBFIRST, [$bf] ' send burst mode control $bf to read all 8 RTC registers in burst mode Shiftout ds_data, ds_clk, LSBFIRST, [rtcsec, rtcmin, rtchr, rtcdate, rtcmonth, rtcday, rtcyear, rtccontrol] send the data low rst ' Reset RTC reset pin
Ok but I have read in a lot of posts regarding the DS1302 and BCD conversion ..does this still apply ?
Kind regards
Dennis
Last edited by Dennis; - 22nd February 2010 at 21:03.
Bookmarks