TRIS setting for the DS1302


Results 1 to 29 of 29

Threaded View

  1. #6


    Did you find this post helpful? Yes | No

    Default starting to make more sense (I think !)

    @ Art
    Thanks a million for the reply.
    I had already checked out code by Cocacolakid as well as Sayzer and quite a few others, as well as Melanie's example MN1307.txt, with little or no success.
    The code from Cocacolakid uses the shiftin/out method not so ?
    This is the reason why I asked about the TRIS statement.
    Check the first few lines of Cocolakid's code:
    Code:
    '-------------------------- Clock Variables ---------------------------------
    
    rst var portb.2 ' DS1302 Reset Pin
    clk var portb.1 ' DS1302 Clock Pin
    dq var portb.0 ' DS1302 Data Pin
    What should the TRIS statement be ? Or is this handled by the SHIFTIN/OUT statement ?
    Later on in his code there is :
    Code:
    '------------------------ Initial Settings For Ports ------------------------
    
    low rst ' Set reset pin low
    low clk ' Set clock pin low
    
    trisb = 0
    trisa = 0
    The forum is scattered with many examples for DS1302 and DS1307 and various timers, clocks elapsed timers, olympic clocks and there are even examples for the various LABX boards,even some methods to use a PIC as a timer with accuracy much like that of a DS1302/7 depending on the crystal you choose.

    With the wealth of information here it starts becoming rather difficult to figure out which clock chip is a good selection and why.

    From what I can see (and I may well be wrong),
    if you're using the DS1302 then you should use a shiftin/out method and
    if you're using a DS1307 you should use the I2C method.

    I am trying to build a very simple alarm clock which triggers on a matching date and time. It will also be used as a datalogger for logging the time and duration of power failures for my generator since we have many power failures in our area at some really odd times.

    Your info has been most useful in starting to figure out some parts of this puzzle.

    Any more info you or anyone else would also be most welcome.

    Kind regards

    Dennis
    Last edited by Dennis; - 21st February 2010 at 22:06.

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