RTC chip or PIC?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938

    Default RTC chip or PIC?

    Hello,

    I was asking myself why one would prefer to use an particular RTC chip instead of using a PIC running a 32,768kHz crystal?

    Unfortunately, I don't have such a crystal in my drawer and can't make any tests but is there anything "obvious" making a big difference I do not see?
    Roger

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I like RTC because of all of the built in stuff. Date, time, alarms etc. Save alot of programming and code space. Always running, check it when needed.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex View Post
    ... why one would prefer to use an particular RTC chip ...
    I prefer the ST M41T81. In addition to macrackit's points, it survives power cycles (even recording the time power was lost), can generate a squarewave of several frequencies and battery life is >10 years. I suppose one could duplicate all that with a small PIC but there's no cost saving.
    Last edited by dhouston; - 27th July 2009 at 16:14.

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I prefer the ST M41T81
    Good product, unfortunatly sold only in 8-pin SOIC package.

    Al.
    All progress began with an idea

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default How to trigger the "second" increment?

    I have started some trials with a DS1307.

    Since the smallest "common" change in RTC are seconds, I assume there is no use for the PIC to query constantly the RTC; every second should be enough.

    How do I achieve this? I couldn't find a clue in either datasheets
    http://www.datasheetcatalog.org/data...xim/DS1307.pdf
    http://www.datasheetcatalog.org/data...onics/7529.pdf

    Maybe, I should rather use a RTC chip with alarm such as a DS1678
    http://datasheets.maxim-ic.com/en/ds/DS1678.pdf
    Last edited by flotulopex; - 28th July 2009 at 10:49. Reason: adds
    Roger

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Here is what I do with the DS1337. I have not used the one you have.
    Setup:
    Code:
    SecReg CON $00
    DS_SCL	VAR	PORTD.1
    DS_SDA	VAR	PORTD.0
    RTC	CON	%11010000
    sec VAR BYTE ' seconds
    MINs VAR BYTE ' minutes
    hr VAR BYTE ' hours
    day VAR BYTE ' day
    date VAR BYTE ' date
    mon VAR BYTE ' month
    yr VAR BYTE ' year
    Then when I want to read the RTC:
    Code:
    I2CRead DS_SDA, DS_SCL, RTC, SecReg, [sec,MINs,hr,day,date,mon,yr] 
    PAUSE 100
    Serout2 PORTC.6, 16572, [ "TIME ", HEX2 hr, ":", HEX2 MINs, ":", HEX2 sec,$d, $a]
    Serout2 PORTC.6, 16572, [ "DATE ", HEX2 mon,"-",HEX2 date,"-",HEX2 yr,$d, $a]
    Maybe this can be adapted to yours.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Here are two types:

    RV-3029-C2 : Extremely Accurate RTC Module with embedded Xtal.

    * Offers temperature compensated time (very high time-accuracy of ± 6ppm from -40°C to +85°C and ± 8ppm from -40°C to +125°C.)

    * Integrated Temperature Sensor with digital-output and offers 8 Bytes
    RAM and 2 Bytes EEPROM for customer's application.


    Here is another one:
    RTC-4553
    • Built-in crystal unit.
    • Builtin 30 x 4-bit S-RAM.
    • Reference pulse output. (1024 Hz, 1/10 Hz)
    etc.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  8. #8
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Good product, unfortunatly sold only in 8-pin SOIC package.
    What package would you prefer?

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I think the DS1337's alarm can be set for one second. Probably doing the same thing as Dave mentioned with his.
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Voilà

    Okay.

    So I modified the code as this:
    Code:
    <html><head></head><body><!--StartFragment--><pre><code><font color="#000080"><i>' PIC16F630 Fuses
    </i></font><font color="#008000">@ DEVICE WDT_ON
    
    </font><font color="#000080"><i>'-------------------------------------------------------------------------------
    ' Registers   76543210
    </i></font>WPUA       = %00110100 <font color="#000080"><i>'Weak Pull-up of PORTA for SCL and SDA on DS1307
    </i></font>TRISA      = %00000100 <font color="#000080"><i>'Set Input/Output
    
    '-------------------------------------------------------------------------------
    ' Variables
    </i></font>DSOut    <b>VAR </b>PORTA.2 <font color="#000080"><i>'DS1307 SQW pin #7
    
    '-------------------------------------------------------------------------------
    </i></font>MAIN:
    <b>IF </b>DSOut = 0 <b>THEN
       GOSUB </b>Read_1307  <font color="#000080"><i>'Read the time &amp; date
       </i></font><b>GOSUB </b>lcd
       <font color="#000080"><i>'put PIC in low-power mode for 576+288+72=936ms
       </i></font><b>NAP </b>5
       <b>NAP </b>4
       <b>NAP </b>2
    <b>ENDIF
    GOTO </b>MAIN:
    <b>END
    </b></code></pre><!--EndFragment--></body>
    </html>
    Maybe it doesn't make a lot of sense to put the PIC in low-power mode. How is it done in the "industrial" life?
    Roger

Similar Threads

  1. Camera with PIC chip
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 1st July 2008, 14:28
  2. PIC chip resetting. Very weird
    By The Master in forum Off Topic
    Replies: 0
    Last Post: - 28th October 2007, 17:07
  3. Help on coding/ selecting PIC chip for project
    By lovemeok in forum General
    Replies: 0
    Last Post: - 27th July 2006, 19:21
  4. Best PIC chip..?..
    By Delusional in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th February 2006, 03:17
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

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