Maker Pro
Maker Pro

program pic16f877a for ds1307

I would advise you to read the datasheet for the ds1307, if you haven't already: http://datasheets.maximintegrated.com/en/ds/DS1307.pdf

The ds1307 uses the Synchronous Serial Port (SSP) Module. It operates in I²C mode and is connected too the PIC using the SDA and SCL pins.



Assuming your using a PIC..

The SSP Module has five registers for I²C mode, which need to be setup to interface correctly. An overview on how to do this can be found on pages 15-17 here: http://ww1.microchip.com/downloads/en/DeviceDoc/33023a.pdf

If your PIC supports SSP, you can find more detailed information about each register in the datasheet.


Reading things isn't fun, but it helps..
 
You do not need to learn the entire datasheet, but just familiarize yourself with the basics and how the relevant registers tie in with each other. I would learn about the relevant registers first and which commands to use to set each register. I've listed the relevant ones below.


The Synchronous Serial Port (SSP) module has five registers for I2C operation. They are:
• SSP Control Register (SSPCON)
• SSP Status Register (SSPSTAT)
• Serial Receive/Transmit Buffer (SSPBUF)
• SSP Shift Register (SSPSR) - Not directly accessible
• SSP Address Register (SSPADD)



Also, familiarize yourself with the SDA and SCL pins and how to set up the ports.

Sorry its around page 237.
http://ww1.microchip.com/downloads/en/DeviceDoc/33023a.pdf
 
As Sadlercomfort said, First you should know how the SPI communication works, then its easy to implement it in the Micro. You should go through some sample examples source code just to understand it.
 
Top