Hi all,
I create a simple project to change the start time of DS1307 using I2C interface and PIC16F877A is the master!
But when i start the simulation. The time in DS1307 always starts at 00:00:00 , it doesn't change anything.
Any suggestion?
Thank you!
The source code was written by mikroC
I create a simple project to change the start time of DS1307 using I2C interface and PIC16F877A is the master!
But when i start the simulation. The time in DS1307 always starts at 00:00:00 , it doesn't change anything.
Any suggestion?
Thank you!
The source code was written by mikroC
Code:
void main()
{
Delay_ms(100);
I2C_Init(100000); // initialize I2C communication
I2C_Start(); // issue I2C start signal
I2C_Wr(0xD0); // send byte via I2C (device address + W)
I2C_Wr(0x00); // send byte (address of DS1307 location)
I2C_Wr(0x02); // send data (data to be written)
I2C_Wr(0x02); // send data (data to be written)
I2C_Wr(0x02); // send data (data to be written)
I2C_Wr(0x02); // send data (data to be written)
I2C_Wr(0x02); // send data (data to be written)
I2C_Wr(0x02); // send data (data to be written)
I2C_Stop(); // issue I2C stop signal
Delay_100ms();
}
![164-I2Cproteus-1.jpg](http://static.electro-tech-online.com/imgcache/164-I2Cproteus-1.jpg)