Real time clock ICs


Closed Thread
Results 1 to 40 of 67

Hybrid View

  1. #1
    Eng4444's Avatar
    Eng4444 Guest

    Exclamation Real time clock ICs

    Hello,

    i'm again search for Real time clock but this time, not for DS1307.

    Could anyone provide me with any PicBasic Pro program for any real time clock IC used with any PIC?

    i'll just buy both ICs and make my life easier... because i'm about to break my head with this DS1307 and PIC16F876A ...

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


    Did you find this post helpful? Yes | No

    Post

    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eng4444
    Hello,

    i'm again search for Real time clock but this time, not for DS1307.

    Could anyone provide me with any PicBasic Pro program for any real time clock IC used with any PIC?

    i'll just buy both ICs and make my life easier... because i'm about to break my head with this DS1307 and PIC16F876A ...
    This one is for the PCF8583 from Philips. Perhaps you can use this as a starting point to talk to either this device or a DS1307.

    ' Read the time in BCD format
    RTC_GetTime:
    I2Cread i2sda, i2scl, $A3, 2, [Second, Minute, Hour]
    return

    Jerson

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


    Did you find this post helpful? Yes | No

    Smile

    Hello Eng444,

    What's the problem? This forum has many examples of using RTC's including one back in Oct 2004 by Tonigalea that uses a DS1337. Paul Borgmier (sp? sorry) put 2 really nice RTC programs on this site last year that don't even use a separate RTC chip. I have tried them and they work very nice. They even have an alarm time example in them. I am on my 3rd project now using the DS1337 RTC. I use this as my projects need to keep accurate timing with a battery backup. I have even done routines to handle daylight savings time. I have used this RTC with a 16F88, 16F877A, and a 18F452. They are easy to work with but with everything else in life there is a learning curve. I found it very worth the time I invested.

    There are also several examples of elapsed time counters here on this site from Darrel Tayor. Melanie has given us the Olympic Timer based on the 1302 RTC. She also has a clock program posted on the MELabs website.

    Your post did not say specifically what your problem is. Some RTC's require converting data from the RTC from BCD to decimal. Paul Borgmier's clocks don't use this conversion. Tonigalea's DS1337 program doesn't use it.

    Read through the posts here on this site and try a few things. Let us know more about the problem so we can help you! The people here are great and willing to help!

    BobK.

  5. #5
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation Thank you BobK

    I am working on a certain project and do not have any knowledge in RTC, nor how to program them. In fact, i just learned PicBasic Pro...

    I have Pic16F876A and i am trying to manage to make my DS1307 work.

    I Have read all the examples but as i am new to this thing, i didn't understand them...

    i do not need alarms...etc etc i do not need it sophisticated at all. i am to calculate Energie which is given by: Energy = Power * time.

    i already got power in a certain variable and now, i need to get the time elapsed in order to multiply by power...

    any help?

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Eng 4444,

    If you aren't looking for a "time stamp" of time and date then what you should try is Darrel Taylor's "Elapsed Timer" program on this site. Your program can control when to start timing and when to stop timing. Melanie's "Olympic Timer" is another example of a start and stop timer. You should look at these two programs. Both of them output the result to an LCD display. Both of these programs use a background timer using the PIC's timers. You can have your PIC do the calculations based on the inputs and then display the results.

    The May 2006 issue of Nuts and Volts magazine has a nice tutorial on using PIC timers including a sample program that should help you out understanding how these timers are used. I believe this forum also has numerous posts relating to using PIC timers. I personally am just starting to use them so I wouldn't be much help in the actual design of one at this point. I just have a basic understanding of how they work.

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


    Did you find this post helpful? Yes | No

    Lightbulb

    Also as BobK pointed in right direction, have the followings into consideration.

    If you use RTC to calculate the elapsed time, you will have difficulties when time passes from one minute to other, or from one hour to other. You will be lost in HEX conversions to come with elapsed time.

    I highly recommend using Melanie’s Olympic timer. It is already a timer just as you need, it is not an RTC.

    It is quite easy to implement it into your PIC; even if you can’t use it with your PIC, have your energy calculation in your PIC by getting a signal from a separate PIC in which the Olympic timer is implemented.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  8. #8
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation

    Quote Originally Posted by BobK
    Hi Eng 4444,

    should try is Darrel Taylor's "Elapsed Timer" program on this site. Your program can control when to start timing and when to stop timing. Melanie's "Olympic Timer" is another example of a start and stop timer. You should look at these two programs.
    __________________________________________________ ______________

    Sorry but where to find those 2 programs on this website? in which section?

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


    Did you find this post helpful? Yes | No

    Default Just checking

    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
    Last edited by Jumper; - 1st June 2006 at 15:16.

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

  11. #11
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Arrow Assistance please..

    Quote Originally Posted by Jumper
    call each part with a GOSUB

    Good luck and enjoy
    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++

    What do you mean by this?

    could anyone explain to me?

    of course i need it to show constantly the time and keep on incrementing seconds, minutes, hours, days...

    so what is this GOSUB? and how to use it?
    One more things, what to do if i want to set time and date as:
    02:10:00 3-6-2006?

    where to write them?in which sentence?

    urgent help is needed because i am working right now on this...

Similar Threads

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

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