DS1307 returns incorrect data ???


Results 1 to 18 of 18

Threaded View

  1. #10
    Join Date
    Jul 2008
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Isn't writing $15(hex) the same as 21(dec)???
    I see some examples are writing a bunch of hex characters...

    I2CWrite PORTC.2,PORTC.3,$D0,$00,[$00, $15, $15, $05, $01, $10, $09, $10]

    Marty.


    Quote Originally Posted by sinoteq View Post
    Hi
    I wounder if you have not done a mistake in how you use the RTC, the DS has a "funny" way to handle numbers. They are BCD coded and can not be written as Decimal numbers straight. You say you write I2CWrite PORTC.2,PORTC.3,$D0,$00,[0, 15, 15, 5, 1, 10, 9, 10]. Please look at the datasheet Timekeeper registers. If you want to load 15 minutes in the DS you have to write it as 21DEC. Why? Becasue the low 4 bits are minutes and the higher 3 bits are 10 minutes so.... Low bits should be 5 (%0101) and then we need 1 ten-minutes thus getting %00010101

    Minutes and Hours are kind of straight forward BCD but the Hours register you have to setup for 12pm or 24 hours function and on top of this use BDC codes.

    You can not use almost any register from the DS without convering it from BCD code and you get 90 and the strange jumps becasue of this.
    Last edited by gtvmarty; - 6th October 2009 at 06:39.

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 01:51
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 0

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