TRIS setting for the DS1302


Closed Thread
Results 1 to 29 of 29

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dennis View Post

    Regarding this line though ...
    Code:
    Write_1307:                          ' Set time & date to 19:00:00  14th Feb 201
    , do you think they made much of a fuss about Valentines day back then ?
    I also wonder if this isn't how the Rosetta stone came about, some ancients trying to scribe stuff into a rock...it's just like us really .. we are making rock (Silicon) do some really wild things.
    Even wirelessly rock to rock ...INSANE hey ?
    Now to explain those cave paintings !

    Chat soon

    Kind regards

    Dennis
    LOL - must check my posts before uploading

  2. #2


    Did you find this post helpful? Yes | No

    Default ok :-) definitely gonna try this tonight!

    @Steve ..apologies .. was actually asking Malc-c about valentines day :-)
    @ Steve , regarding these lines :
    Code:
    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
    I understand these
    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

  3. #3
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    $bf is the register address for clock burst mode read I believe.

    Do a search for $bf in the ds1302 data sheet.


    steve

  4. #4


    Did you find this post helpful? Yes | No

    Default Thanks 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

  5. #5


    Did you find this post helpful? Yes | No

    Default ok read funstion understood !

    @ Steve ...
    Do you have a snippet for the write in burst mode so one can set the clock ?

    Kind regards

    Dennis

  6. #6
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Sure, this should do it:

    Code:
    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

  7. #7


    Did you find this post helpful? Yes | No

    Default ok .. i was close then

    @Steve

    My code before you replied ...
    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
    As you can see I was totally off the mark with the $bf , $be setting !

    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.

Similar Threads

  1. real time clock
    By maria in forum Code Examples
    Replies: 44
    Last Post: - 1st March 2022, 12:13
  2. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 14:01
  3. DS1302 16F628 Woes
    By idtat in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th January 2009, 14:15
  4. TRIS E setting for 18F2550
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd May 2007, 07:47
  5. Is LCDOUT setting always al TRIS ?
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th June 2005, 17:02

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts