Quantcast
Channel: Clock - Timer Projects - PIC Microcontroller
Viewing all articles
Browse latest Browse all 218

Interfacing DS1307 Real time clock with PIC16f877

$
0
0

In any advance project we need real time clock synchronize with our work and for this purpose the best option is DS1307 (RTC Ic). Interfacing DS1307 Real time clock with PIC16f877 is done by I2C communication. To know I2C protocol you may refer my previous post “Interfacing external EEPROM with PIC Microcontroller”.  To know about Interfacing DS1307 Real time clock with PIC16f877, we should know something about DS1307 IC.

Real time clock ( DS1307):

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 I2C, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The DS1307 operates as a slave device on the I2C bus. Access is obtained by implementing a START condition and providing a device identification code followed by a register address. Subsequent registers can be accessed sequentially until a STOP condition is executed.

Interfacing DS1307 Real time clock with PIC16f877 schematic

Project Description:

In this project we will see how we interfaced DS1307 with pic16f877 via I2C protocol. After interfacing DS1307 we recive the data from DS1307 and display it on LCD. Weall ready know before that DS1307 is send data in full BCD format. So we have to convert this data in digit and send to display on LCD.

Now question is how we convert BCD number to 4 bit number?

For getting higher nibble we use command

return ((bcd >> 4) + ‘0’) : it means the number will be Binary Right Shift 4 times with loading zero on left side.

For getting Lower nibble we use command

return ((bcd & 0x0F) + ‘0’) : it means we did and operation 0F with BCD number.

 

For more detail: Interfacing DS1307 Real time clock with PIC16f877

The post Interfacing DS1307 Real time clock with PIC16f877 appeared first on PIC Microcontroller.


Viewing all articles
Browse latest Browse all 218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>