Real time clock ICs


Closed Thread
Results 1 to 40 of 67

Hybrid View

  1. #1
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Thumbs up You are an excellent person!:-)

    Quote Originally Posted by Jumper
    Hi,

    If you dont use a backup battery for the 1307 make sure that the un-used leg for the backup function is tied to ground. You can find this in the datasheet but if this is not done the chip will not work properly (sometimes it doesn't, other times it does but never when you want it to).

    We are using the 1307 and it is doing fine.


    TRIS? = %00000000 ' all pins to output just replace ? with port name

    SDA var Port?.? 'define port for I2C communication replace ?.? with pin
    SCL var Port?.?

    Hours var Byte
    Minutes var Byte
    Seconds var Byte
    RTC var Byte
    I2C_Adr_B var byte


    RTC = % 11010000 ' Device adress on I2C bus
    I2C_Adr_B=0

    I2CWRITE SDA,SCL,RTC,I2C_Adr_B,[128,0,0,0,0,0,0,128] 'Reset time to 0 and stopped, 12 hour setting

    Start_RTC:
    I2C_Adr_B=0
    I2CWRITE SDA,SCL,RTC,I2C_Adr_B,[0,0,0,0,0,0,0,16] 'Start RTC if you put a resistor and LED between the "SEC" pin and 5V it should start flash 1/s
    return

    RTC_Read:
    I2C_Adr_B=0
    I2CREAD SDA,SCL,RTC,I2C_Adr_B,[seconds,minutes, hours] ' in bcd code
    return

    call each part with a GOSUB

    Good luck and enjoy
    __________________________________________________ _____________

    i wouldl ike to thank you so much! but now i returned home and far from my Lab. I will try it tomorrow. is it suitable for PIC16F876A? and by the way, how to set the date and time to: "10:15:30 01-06-2006 "? can you tell me how and in which part of your program?

    thank you again....

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Eng4444,

    The simplest way is to set those values as the variables for hours, minutes, seconds, month, date, year and then write them into the RTC. Obviously the minutes setting should be a few minutes ahead of the actual start time to allow you time to program the PIC and then put it into your board and start the board up. That's what I do to start the clock on my boards.

    BobK

  3. #3
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default some more checking

    Hi,

    Just to be really sure. Don't forget to put pullup resistors 4k7 between [SDA --> 5V] and [SCL --> 5V].

    Another thing we have seen is that adding "DEFINE I2C_SCLOUT 1" (this makes the SCL line bipolar) can help if there is a lot of noice in your set up. This is not the solution for a bad design just a way to try to get the best possible chance to communicate with the 1307.

    I am sure that as soon as you get the chip to respond your learning curve will go thru the roof.

  4. #4
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb Thanks again:-)

    I'll try all of this in 4 hours... i really hope it will work!!

Similar Threads

  1. real time clock
    By maria in forum Code Examples
    Replies: 44
    Last Post: - 1st March 2022, 13:13
  2. Real Time Clock
    By in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd June 2012, 05:52
  3. real time clock - PCF8583
    By maria in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 15th April 2010, 16:41
  4. Real Time Clock
    By savnik in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th December 2006, 03:02
  5. Real time clock... what a headache!
    By Eng4444 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 8th June 2006, 22:56

Members who have read this thread : 2

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