Looking at you code, I don't see anything glaringly wrong, but if we look at the DS1307 datasheet, page 13, it specifies that to do a data read from a specific location you write the address, the location in the DS1307 registers, then initiate a "Repeated Start" routine, send the address again, then read the data. You can read in a multibyte burst, sequentially, or a single byte and then send a STOP and start the process over again at a different register location.
I was recently finding an attempt to communicate between a master and slave PIC unsuccessful, and I had a DS1307 lying around, so I whipped up some code. Thankfully, for i2c.h, no more bit-banging. The code is written for the PIC18F8722, but you should find that something similar will work for you:
#include <pic18f8722.h>
#include <i2c.h>
#include <spi.h>
#include <delays.h>
#include "LCD.h"
#include "SerComm.h"
#pragma config OSC = HSPLL
#pragma config WDT = OFF
#pragma config FCMEN = OFF
#define newline 0x0A
#define carriageReturn 0x0D
void initialize(void);
unsigned char x;
unsigned char seconds = 0x00;
unsigned char minutes = 0x36;
unsigned char hours = 0x48;
unsigned char days = 0x03;
unsigned char date = 0x17;
unsigned char month = 0x08;
unsigned char year = 0x15;
unsigned char hyear, lyear, hmonth, lmonth, hdate, ldate, hdays, ldays, hhours, lhours, hminutes, lminutes, hseconds, lseconds;
unsigned char time[7];
void main(void)
{
lcdInit();
initialize();
CloseI2C2();
OpenI2C2(MASTER, SLEW_OFF);
IdleI2C2();
StartI2C2();
WriteI2C2(0xD0);
WriteI2C2(0x00);
WriteI2C2(seconds);
WriteI2C2(minutes);
WriteI2C2(hours);
WriteI2C2(days);
WriteI2C2(date);
WriteI2C2(month);
WriteI2C2(year);
StopI2C2();
while(1)
{
IdleI2C2();
StartI2C2();
WriteI2C2(0xD0);
WriteI2C2(0x00);
RestartI2C2();
WriteI2C2(0xD1);
for(x = 0; x < 6; x++)
{
time[x] = ReadI2C2();
AckI2C2();
}
time[6] = ReadI2C2();
NotAckI2C2();
StopI2C2();
hyear = ((time[6] & 0xF0) >> 4) + 0x30;
lyear = (time[6] & 0x0F) + 0x30;
hmonth = ((time[5] & 0xF0) >> 4) + 0x30;
lmonth = (time[5] & 0x0F) + 0x30;
hdate = ((time[4] & 0xF0) >> 4) + 0x30;
ldate = (time[4] & 0x0F) + 0x30;
hdays = ((time[3] & 0xF0) >> 4) + 0x30;
ldays = (time[3] & 0x0F) + 0x30;
hhours = ((time[2] & 0x10) >> 4) + 0x30;
lhours = (time[2] & 0x0F) + 0x30;
hminutes = ((time[1] & 0xF0) >> 4) + 0x30;
lminutes = (time[1] & 0x0F) + 0x30;
hseconds = ((time[0] & 0xF0) >> 4) + 0x30;
lseconds = (time[0] & 0x0F) + 0x30;
lcdGoTo(0x00);
lcdWriteString("Time: ");
lcdChar(hhours);
lcdChar(lhours);
lcdChar(':');
lcdChar(hminutes);
lcdChar(lminutes);
lcdChar(':');
lcdChar(hseconds);
lcdChar(lseconds);
SerTx(hhours);
SerTx(lhours);
SerTx(':');
SerTx(hminutes);
SerTx(lminutes);
SerTx(':');
SerTx(hseconds);
SerTx(lseconds);
SerTx(newline);
SerTx(carriageReturn);
}
}
void initialize(void)
{
TRISAbits.RA2=0; // Chip select pin for the SPI port expander;
TRISDbits.RD5 = 1; //Set the ports of the I2C bus;
TRISDbits.RD6 = 0;
SSP2STAT = 0x80; //Disable the slew rate control;
SSP2CON1 = 0x28; //Enable the Serial Port, Set the mode to: Master Mode, clock = Fosc/(4*(SSP1ADD + 1);
SSP2CON2 = 0x00; //No bits to set here;
SSP2ADD = 0x59; //Set to 100 kHz at 40 MHz clock;
TXSTA1 = 0x24; //Set serial communication to High Speed, TX enabled, 8 bit mode;
RCSTA1 = 0x90; //Enable the serial port, Enable the Receiver;
BAUDCON1 = 0x00; //;
SPBRG1 = 42; //57600 kBaud;
}
Please, don't be too harsh on the code. I hope this helps.