Pcf8563p Rtc Trouble


Results 1 to 8 of 8

Threaded View

  1. #5
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    971


    Did you find this post helpful? Yes | No

    Default

    - Dan -

    I don't have exactly what you want, but I have worked on a PCF8583 from Philips. Perhaps they are similar. You figure it out. Use it as a guideline if you may. Part of init is to set the SDA and SCL lines as outputs via the TRIS command.

    Code:
    '================================================================================
    ' I2C   RTC PCF8583  CODE  using I2C_read and I2C_write routines of compiler
    '================================================================================
    ' RTC registers are defined
    ' 0       -       Command / Status register
    '   .0  timer flag
    '   .1  alarm flag
    '   .2  alarm enable 1 -  enabled
    '   .3  mask flag
    '   .54  function 00 clock 32.768KHz/01 clock 50Hz/10 evt counter/11 test
    '   .6  hold last count flag
    '   .7  stop counting, reset divider
    ' 1       -       1/10 s | 1/100s
    ' 2       -       10s    | 1s       seconds
    ' 3       -       10m    | 1m       minutes
    ' 4       -       10h    | 1h       hours
    '   .3..0 unit hours BCD
    '   .54   10s hours 0..2 binary
    '   .6    1 PM
    '   .7    1 12 hour format
    ' 5       -       10d    | 1day     Day & Year
    '   .3..0 unit days BCD
    '   .54   ten days 0..3 binary
    '   .76   year 0..3 binary (read 0 if mask)
    ' 6       -       10mo   | 1month   month
    '   .3..0 unit months BCD
    '   .4    ten months
    '   .7..5 weekdays 0..6 binary (read 0 if masked)
    ' 
    ' 0x10 to 0xff  RAM
    
    ' If RTC is not running, start it
    TimerOff:
        I2CWRITE SDA, SCL, $A2, ControlReg, [0]
        return
        
    ' Read the time in BCD format
    RTC_GetTime:
        I2Cread SDA, SCL, $A2, SecondsReg+0, [Time[2],Time[1],Time[0]]
        return
    
    ' Set time in BCD format
    RTC_SetTime:
        I2Cwrite  SDA, SCL, $A2, SecondsReg+0, [Time[2],Time[1],Time[0]]
        goto  TimerOff
    Last edited by Jerson; - 24th November 2007 at 15:00.

Similar Threads

  1. Low battery signal from an RTC
    By ardhuru in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th March 2008, 18:13
  2. PIC 16F877 I2C communications
    By sigmoideng in forum General
    Replies: 7
    Last Post: - 13th July 2007, 11:28
  3. Using RTC to generate long time delays
    By schlaray in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd January 2007, 01:31
  4. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 18:07
  5. X1226 RTC - Help
    By charudatt in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th August 2006, 18:54

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