DS1307 and a LED array, need ideas


Closed Thread
Results 1 to 13 of 13

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    It takes a 10 millisec PAUSE after each I2CREAD statement to read the clock time from the DS1307, so it would be too slow for your requirement.
    Not correct. Some I2C devices require a PAUSE after a WRITE statement, but READs are performed usually at max speed. The DS1307 certainly does NOT require any pauses for READing.

    There are many ways of accomplishing this without going into interrupts. Here's two...

    Software route: At the end of every row scan simply bump a BYTE Counter. When the Counter rotates through Zero (just over three times a second if you are scanning rows every 1.2ms), then do your I2CREAD of the DS1307. You'll be updating your time about three times a second.

    Hardware Assisted Route: The DS1307 has a pin which can give you a pulse every Second. Several pins on PortB have the facility to set a FLAG in a Register when the state of the pin changes. Simply check the Flag at the end of a scan and do a DS1307 READ when the Flag pops up.

  2. #2
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    Hardware Assisted Route: The DS1307 has a pin which can give you a pulse every Second. Several pins on PortB have the facility to set a FLAG in a Register when the state of the pin changes. Simply check the Flag at the end of a scan and do a DS1307 READ when the Flag pops up.
    I like this! I have not used the DS1307 yet, and usually I would increment a counter like your other suggestion, but I will keep this in mind in the future. Thanks, Melanie.
    Shawn

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


    Did you find this post helpful? Yes | No

    Default

    Actually, just between you, me and the rest of the forum, I hate the DS1307. It's overpriced for what it is (even when bought in large quantities), and has worse timekeeping than your average 99 cent Chinese Digital Watch (even when you perfectly match the specified 12.5pF crystal with it).

    To be honest, what I'm doing nowadays is designing-out the DS1307, chosing a micropower PIC, running it from two supplies (+5v for normal operation and +3v Battery back-up) and using a background Interrupt Routine that runs 24/7. The accuracy (for Data-Logging) is no worse than a DS1307 and you save yourself a dollars worth of chip, plus crystal, plus PCB real-estate!

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    To be honest, what I'm doing nowadays is designing-out the DS1307, chosing a micropower PIC, running it from two supplies (+5v for normal operation and +3v Battery back-up) and using a background Interrupt Routine that runs 24/7. The accuracy (for Data-Logging) is no worse than a DS1307 and you save yourself a dollars worth of chip, plus crystal, plus PCB real-estate!
    And if you trim the Xtal with a trimmer it is going to be even more accurate.

    Also somewhere in this forum there was a thread for canceling out the clock error but cannot find it.

    Ioannis

  5. #5
    Join Date
    Feb 2007
    Posts
    55


    Did you find this post helpful? Yes | No

    Default

    Are you scrolling the time on your display?



    This project i built a few months ago, uses a 8x7 led matrix & DS1307 RTC

    It reads the DS1307 at the end of the scroll cycle when the display is blank.

  6. #6
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Thanks for your replies Melanie, one question, do you know how long it takes (in milliseconds) for the DS1307 to be read into a picbasic variable?

    Quote Originally Posted by Melanie View Post
    Not correct. Some I2C devices require a PAUSE after a WRITE statement, but READs are performed usually at max speed. The DS1307 certainly does NOT require any pauses for READing.

    There are many ways of accomplishing this without going into interrupts. Here's two...

    Software route: At the end of every row scan simply bump a BYTE Counter. When the Counter rotates through Zero (just over three times a second if you are scanning rows every 1.2ms), then do your I2CREAD of the DS1307. You'll be updating your time about three times a second.

    Hardware Assisted Route: The DS1307 has a pin which can give you a pulse every Second. Several pins on PortB have the facility to set a FLAG in a Register when the state of the pin changes. Simply check the Flag at the end of a scan and do a DS1307 READ when the Flag pops up.

  7. #7
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by peu View Post
    Thanks for your replies Melanie, one question, do you know how long it takes (in milliseconds) for the DS1307 to be read into a picbasic variable?
    how impolite on my part, I wanted to say thanks to ALL who replied

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


    Did you find this post helpful? Yes | No

    Default

    Ohhh... that's not an easy question to answer without actually timing it on a scope... it will depend on the number of bytes you're reading at a time, etc etc.

    But as a guesstimate, reading back say 8 bytes in one block (sequentially grab Registers 00-07), you might need as many as 150 bits at 100kHz... so I guess it could be as short as 1.5mS, and under 1mS if you're just grabbing the first three Resisters for the TIME only.

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts