The DS1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through an I²C, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with AM/PM indicator. The DS1307 has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. Timekeeping operation continues while the part operates from the backup supply.
What have you done so far? Have you got an LCD display? What type of LCD display, dot-matrix, or individual segments? Is it a fully graphical LCD or is it segmented? Does it have an integrated controller? What is the interface of the controller, if any?i tried with that datasheet.
But somehow could not display Hours, min , Sec on LCD display
Please help me out.
You have not as yet described your problem. However, I believe I can tell you why your DS1307 is not working. Assuming that you have implemented the SPI data read and write functions correctly in software then most likely you have not enabled the 32,768Hz oscillator. Until you set the CH bit in register 00 high, the 32,768Hz oscillator will not oscillate and you will not be able to read the time. The chip comes from the manufacturer with this bit set to 0. YOu will get nothing from teh RTC until you write a "1" to the CH bit. This suggestion comes from personal experience.How to implement a RTC without using any timer in PIC 16F887 ?
How to use DS1307 to achieve RTC for PIC?
RTC_rd:
call I2C_STRT
movlw 0XD0 ; slave address + write
movwf I2C_Value
call I2C_SEND
movlw 0X00 ; set word address to seconds register
movwf I2C_Value
call I2C_SEND
call I2C_STRT
movlw 0XD1 ; slave address + read
movwf I2C_Value
call I2C_SEND
call read_RTC ; read the seconds data
movwf SECS ; save it
call ack
movlw 0X01 ; set word address to seconds register
movwf I2C_Value
call I2C_SEND
call I2C_STRT
movlw 0XD1 ; slave address + read
movwf I2C_Value
call I2C_SEND
call read_RTC ; read the seconds data
movwf MINS
call ack
movlw 0X02 ; set word address to seconds register
movwf I2C_Value
call I2C_SEND
call I2C_STRT
movlw 0XD1 ; slave address + read
movwf I2C_Value
call I2C_SEND
call read_RTC ; read the seconds data
movwf SECS
call nack
call I2C_STP
return
read_RTC:
bsf I2C_DTA ; set SDA for input
movlw 0x08 ; send 8 bits
movwf COUNTER5
bcf I2C_CLOCK ; SCL low (output)
clrf I2C_Value ; clear var
;rlf I2C_Value, 1 ; rotate carry in
;clrf I2C_Value ; clear var again
I2C_read_loop:
rlf I2C_Value, 1
bsf I2C_CLOCK ; SCL high (input)
btfsc PORTC,4
bsf I2C_Value, 0 ; if data out = 1, set bit
;bcf I2C_CLOCK
bcf I2C_CLOCK ; SCL low (output)
decfsz COUNTER5, 1
goto I2C_read_loop
movf I2C_Value, 0
return
Do you have an oscilloscope or a logic analyser to test the circuit?I tried putting 1 there but it did not work
Can you post a schematic? I am particularly interested in what you have done regarding the backup battery input.I tried putting 1 there but it did not work