PIC16F887 and DS1307


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    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 09:21.

  2. #2
    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 22:11.

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

  4. #4
    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?

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

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    $EC is not a valid conversion requirement for this application.
    My point was that there isn't any sort of error checking, flipped bits, logic errors, and so on...

  7. #7
    Join Date
    Sep 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Hi!!!
    I just wan't to know if its possible how i can set manualy the initial time of the clock using a bic basic code!i tried to do it but i found some problems due to bcd and hex code!
    so there someone that do it?!?!

    thank you so much

    bye bye Cris

Similar Threads

  1. Pic16f887 vs ds1307
    By larzazral in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th January 2010, 04: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