PIC16F887 and DS1307


Closed Thread
Results 1 to 22 of 22

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Here are a few things that 'may' help;

    1. If you're using an oscillator >8MHz, then you'll want to include DEFINE I2C_SLOW 1
    since the 1307 max clock speed is 100kHz.

    2. The SQW output is an open-drain type. I.E. it cannot output a logic 1. Use a 10K
    pull-up on the SQW output. Then you should see a square wave output on your scope.

    3. Use the external pull-ups on SDA and SCL.

    4. Connect a 3V battery to the 1307 Vbat input.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    non of the above really helps.
    Probably the 1307 is dead.

  3. #3
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    I replaced the DS1307 with VS1307 which seems to work.
    Is there any other way to convert the data to dec other than:

    I2CRead SDA, SCL, $D0, $00, [A]
    Sec1=(A.0*1)+(A.1*2)+(A.2*4)+(A.3*8)
    Sec10=(A.4*1)+(A.5*2)+(A.6*4)
    Last edited by menta; - 5th July 2008 at 10:21.

  4. #4
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Now I need to understand how to convert from decimal (which comes from the user setup) to write to the RTC chip.
    Last edited by menta; - 5th July 2008 at 23:11.

  5. #5
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Found it
    ConvertBCD:
    CounterB=CounterA DIG 1
    CounterB=CounterB<<4
    CounterB=CounterB+CounterA DIG 0
    Return

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by menta View Post
    Found it
    What happens if CounterA = $EC?

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


    Did you find this post helpful? Yes | No

    Default

    We're talking about a DS1307 RTC here (and ignoring the MSB of certain Registers) where the only valid individual digits are in the range 0-9. The subroutine converts two digit DECIMAL in the range 0-99 to a single BCD Byte. $EC is not a valid conversion requirement for this application.

Similar Threads

  1. Pic16f887 vs ds1307
    By larzazral in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th January 2010, 05:12

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