PCF8563 date data corrupted


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2011
    Posts
    18

    Default PCF8563 date data corrupted

    PIC16F628, Pic Basic Pro 2.60, Pickit programmer

    Good day ,
    Below is my code to read the PCF8563:

    I2Cread SDA,SCL,rtcadd,rtcloc,[secs,minu,hrs,DoM,doW,mon,year]
    gosub waita 'read D&T data then wait 10ms

    write $20,secs,minu,hrs, DoM,doW,mon,year 'write D&T data to F628 eeprom

    When I read the data in the F628 eeprom I get correct minutes seconds and hours but the DoM,dOW,mon,year
    data is corrupt. Every time I run that code the calendar data changes to something different and sometimes
    some of the data is correct.

    When I set alarms they work correctly.

    When I replace the PCF8563 with a DS1307 and change the addresses accordingly, the program works perfectly.

    I want to use this PCF8563 because it has alarms and battery voltage sensing that the DS1307 doesn't have.

    I have also tried 3k3 resistors on SCL & SDA instead of 4k7 but that made no difference.

    Can somebody help please.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,379


    Did you find this post helpful? Yes | No

    Default Re: PCF8563 date data corrupted

    you need to mask off the bits that are not used for the value being returned

    Code:
        minu = minu & $7f
        hrs  = hrs  & $3f
        Dow  = dow  & 7
        Dom  = dom  & $3f
        mon  = mon  & $1f
    Warning I'm not a teacher

  3. #3
    Join Date
    Nov 2011
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: PCF8563 date data corrupted

    Thank you very much Richard , your advice fixed my problem.
    I am so happy 'cause I really like this chip.
    Now I can apply my mind to getting an interrupt every minute which
    appears to be quite cumbersome.

    Regards
    Hebe

Similar Threads

  1. My date this weekend.
    By Christopher4187 in forum Off Topic
    Replies: 16
    Last Post: - 29th January 2008, 17:45
  2. Bootloader corrupted at low voltage
    By BrianT in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd November 2007, 15:56
  3. Array data being corrupted
    By caverman in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th March 2006, 05:22
  4. calculate with date
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th October 2005, 17:49
  5. 16F88.bas corrupted
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th April 2005, 18:21

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