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

    Exclamation By the way BobK,

    you said:

    "
    "What Jumper is referring to with the GOSUB is that the routines "Start_RTC" and "RTC_Read" are called from your main program. Read the PBP manual referring to the word "GOSUB" for a further explanation.

    The clock setting portion is, as I stated in an earlier reply, is handled in the setup of the clock. You put these values in the variables for the clock, meaning "seconds", "minutes", "hours", etc then write them into the RTC. "
    __________________________________________________ ______________

    So do you mean that i should write all the program:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    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

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    in the PIC16F876A directly and it works?

    let's say i want to chose port B and pin 22 which is RB1
    23 which is RB2
    so i write:
    TRISB = %00000000
    SDA var PortB.1
    SCL var PortB.2
    true?
    and i wire b.1 to sda of DS, B.2 to SCL DS.... right?



    Now tell me, if i just connect PIC16F876A to this DS1307 and a 4 lines LCD (or 2 lines). and let's say i just want to use this whole PIC just for the DS (it's stupidity i know but let's say i will keep all ports not used) would this program, as he gave it to me, be enough to begin displaying time and date on LCD? or i should write more things that he didn't write thinking that i should know them..... ?

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Since my original program was configured for a 4-Line LCD (which extensively used the LCDOut command), and you're using a 2-Line LCD which does not, unless you make significant changes to the program to compensate for the difference it's not exactly going to work, is it?

    You might need to be aware, that a 2-Line LCD communicates by SERIAL asynchronous. For reliability your PIC will ideally need to be driven by an Xtal or Resonator and not rely on the Internal Oscillator. See Thread...

    http://www.picbasic.co.uk/forum/show...nal+Oscillator

    A 4 or 8-wire connected LCD does not have this limitation.

    You obviously haven't a clue as to what you're doing. With your level of expertise, unless you EXACTLY replicate programs and hardware examples that are posted - without changes, your chances of success are slim to none.

    Let me put this into perspective... I catch a Cold. I therefore go into a BioMed Lab to devise a cure. I only need to cure my Cold, and then I will never set foot in a BioMed Lab ever again. I give myself a week to accomplish this... I am not a Doctor or a Scientist or even a BioMed Technician. All I know is that the Plasma they drip into your arm is the same stuff that drives the Starship Enterprise...

  3. #3
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation Dear Melanie,

    I already said that i have no clue...

    i have LCD 4 lines so i will try it....

  4. #4
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation By the way...

    This DS1307... we do not program it? just access it from PIC?

    A Professor here said that i am obliged to program it... one of us is stupid so who is it?


    for me, i have read so many examples but i never noticed that i should program a DS1307.... i just have to connect it to PIC and then access it by the program..

    Am i mistaken?

  5. #5
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Program it

    I think that the professor is using "program" loosely. You will write the time and date therby "programming it".

    Travin

  6. #6
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    There are also a few control bits that might need configuring - 12/24 hour mode, square wave output & rate, and a whopping 56 bytes of "NV"RAM for you to use... guess those could also fall into the "program" category :-)

    Arch

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    >A Professor here said that i am obliged to program it... one of us is stupid so who is it?

    Have you read the DS1307 Datasheet?

    If you haven't then GO DO IT before you ask questions like the one above.

    You will discover that when you first Power-Up a DS1307 for the first time (regardless if you have a Battery Backup connected or not), it sits there and DOES NOTHING until you enable it by clearing the CH (Clock Halt) bit in one of it's Registers (which Bit in which Register I leave you to discover by READING the device Datasheet). That Sir is called "programming" - apart from that, how's the chip supposed to know what the current Time and Date is from which to continue timing? Telepathy?

    People who can't be bothered to read Datasheets or Manuals and expect everyone else to do their work for them usually get short changed on this forum.

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