TRIS setting for the DS1302


Closed Thread
Results 1 to 29 of 29

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default cool

    @Steve :-)

    Thanks for that info , actually saw your posts as I was sifting through the forum posts on DS1307 and DS1302 and I2Cread and I2CWrite , in fact I even tried it with my DS1302 (of course it didn't work since I2C is not what should be used for the DS1302) :-)
    Will try get something going for the DS1302 using that stub you posted and see what comes of it and will definitely give the DS1307 stubs a good bash when I get my DS1307.

    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

  2. #2
    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

  3. #3


    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

  4. #4
    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

  5. #5


    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

  6. #6


    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

  7. #7
    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

Similar Threads

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