Pcf8563p Rtc Trouble


Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Jul 2007
    Posts
    38

    Default Pcf8563p Rtc Trouble

    Hi,

    I'm using the PCF8563P rtc, i can not get it to work

    ive never used the i2c protocol before, so maybe ive messed it up?

    ive looked through the posts already present on the forum concerning the subject
    and cannot figure it out.

    i would be grateful of any help

    just using the basic 16f84 mcu


    Code:
    'rtc pins
    
    clk_pin var portb.5 
    data_pin var portb.4
    
    
    
    'register address's 
    
     reg_seconds        CON  $02
     reg_minutes        con  $03
     reg_hours          con  $04
     reg_days           con  $05
     reg_weekdays       con  $06
     reg_months_century con  $07
     reg_years          con  $08
     reg_minute_alarm   con  $09
     reg_hour_alarm     con  $0A
     reg_day_alarm      con  $0B
     reg_weekday_alarm  con  $0C
     
     rtc_write var byte 
     rtc_read  var byte
     
     rtc_write=$a2
     rtc_read=$a3 
     
     
     
     'time variables
     
     seconds var byte
     minutes var byte
     hours var byte
     days var byte
     years var byte
      
      
     '-----------------------------------------------------
      'initial time variable values
      
      seconds=0
      minutes=0
      hours=18
      days=23
      years=7 
     
    ' -------------------------------------------------------
     
      init:
     pause 500
     lcdout $fe,1
     lcdout "Real Time Clock"
     pause 1000
     
    
    I2CWrite data_pin,clk_pin,rtc_write,reg_seconds,[seconds]
    pause 10
    I2CWrite data_pin,clk_pin,rtc_write,reg_minutes,[minutes] 
    pause 10
    I2CWrite data_pin,clk_pin,rtc_write,reg_hours,[hours]
    pause 10
    I2CWrite data_pin,clk_pin,rtc_write,reg_days,[days] 
    pause 10
    I2CWrite data_pin,clk_pin,rtc_write,reg_years,[years]
    pause 10
    
    
    main:
    
     I2CRead data_pin,clk_pin,rtc_read,reg_seconds,[seconds]
     pause 10
     I2CRead data_pin,clk_pin,rtc_read,reg_minutes,[minutes]
     pause 10
     I2CRead data_pin,clk_pin,rtc_read,reg_hours,[hours]
     pause 10
     I2CRead data_pin,clk_pin,rtc_read,reg_days,[days]
     pause 10
     I2CRead data_pin,clk_pin,rtc_read, reg_years,[years]
     pause 10
     
                
    pause 500
    lcdout $fe,1  ' clear lcd
    lcdout dec2 hours,":",dec2 minutes,":", dec2 seconds," "
    pause 500
    goto main
    Attached Images Attached Images

Similar Threads

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

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