Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I2C simualtion DS1307 with PIC16F877A

Status
Not open for further replies.

metal312

New Member
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:
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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top