Hello Can any one help me with this code (DS1307 RTCM With PIC16F877a)


Closed Thread
Results 1 to 2 of 2
  1. #1
    Ali Al-Shaybani's Avatar
    Ali Al-Shaybani Guest

    Unhappy Hello Can any one help me with this code (DS1307 RTCM With PIC16F877a)

    Good Day everybody im new to this Programing Language so i was hopping if i can get help here???

    so im interfacing the RTCM DS1307 with the 16F877A i know that there is alot of examples on the net but all of them show the values on an LCD i want to sent the time/date through hyperterminal.

    so i found a code and i was trying to fix it for my need but no luck here it goes

    '************************************************* ***************
    Device = 16F877A
    Config HS_OSC
    Declare Bootloader = On
    Declare I2C_BUS_SCL On
    Xtal = 20
    Hserial_Baud = 9600 ' Set baud rate to 9600
    Hserial_RCSTA = %10010000 ' Enable serial port and continuous receive


    ADCON1=7
    DelayMS 100
    High PORTA.0
    TRISC= %11111111
    SDA var PORTC.4
    SCL var PORTC.3
    DB0 var Byte[8]

    CMCON = %00000111 ' Comparators = off

    DelayMS 1000

    GoSub Write_1307
    read_1307:
    ' Read time Secs,Mins,Hours,Day,Date,Month,Year,Control
    I2CIN SDA,SCL,$D1,$00,[Str DB0\8] ' Read 8 bytes from DS1307


    HRSOut "Time=",Hex2 DB0[2],":",Hex2 DB0[1]
    DelayMS 2000
    End

    Write_1307:
    ' Set time & date to 15:55:00 Tuesday 6th of July 2004
    I2COUT SDA,SCL,$D0,$00,[$00,$55,$15,$2,$6,$7,$4,$90] ' Write to DS1307
    DelayMS 10
    Return ' Sec Min Hr Day D M Y Control
    '********************************************

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Exclamation

    Hello Ali

    Are you sure you have posted on the right forum ???

    Here, it is PicBasicPro from MELABS ...

    I remember there were one or two threads talking about DS1307, here ... so you can try a SEARCH ( upper right of your screen), to get some ideas ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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