DS1307 and PIC16F877A using MPLAB High Tech C Problem..

Status
Not open for further replies.

jeyes56

Member
Hi all,

i would like to use the DS1307 as my RTC for my MCU,(PIC16F877A).
But it seems that i don't understand how to Configure and Read the DS1307.

I've found its datasheet, but i don't understand it either..
Here the Datasheet

Please help me on this..
 
Everyone uses this clock... In My tutorial 6 (derived from Nigel Goodwin's tutorials) you will find the I2C routines...
Just remember that all RTC's use packed BCD... ie..

Internal address 1 contains seconds and the on/off flag " 1 111 1111 " bit 7 = on/off.. bits 6,5,4 = tens (0 - 5) ans bits 3,2,1,0 are units.

Most of the 7 internal registers are setup this way
2 = minutes "x 111 1111" (bit 7 not used ) tens, units
3 = hours "x 11 1 1111" (bit 7 not used ) am/pm or 24 hour , ten, units
etc.. etc..
 
Hi, tnx for your reply..

i am using MPLAB v8.50, it seems that i cant find an I2C routine there,, is there any module on MPLAB?

can you please give me example code that stores hours, min, day, month on there variables?

thank you in advance..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…