metal312
Newbie level 6
- Joined
- Jul 8, 2008
- Messages
- 11
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,347
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
[/code]
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();
}