ADGAN
Full Member level 5
Hi! I'm using a DS1307 and the program is not executing from the read function onwards. I'm using 10K pull up resistors and this is written in MPLAB C18. This is the code:
I have called this function in the main function as follows:
How to resolve this problem?
Code:
void readDS1307(){
StartI2C1();
IdleI2C1();
WriteI2C1(0xD0);
IdleI2C1();
WriteI2C1(0x00);
IdleI2C1();
RestartI2C1();
IdleI2C1();
WriteI2C(0xD1);
IdleI2C();
sec = ReadI2C1();
AckI2C1();
min = ReadI2C1();
AckI2C1();
hr = ReadI2C1();
AckI2C1();
week_day = ReadI2C1();
AckI2C1();
day = ReadI2C1();
AckI2C1();
mn = ReadI2C1();
AckI2C1();
year = ReadI2C1();
NotAckI2C1();
StopI2C1();
}
I have called this function in the main function as follows:
Code:
OpenI2C1(MASTER,SLEW_OFF);
Delay10KTCYx(25);
SSPADD = 99;
writeDS1307();
readDS1307();
How to resolve this problem?
Last edited: