Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2C pic16f877a slave and master

Status
Not open for further replies.

bajra.pradeep

Newbie level 4
Joined
Jan 21, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
Can someone help me with PIC16f877a to PIC16f877a i2c communication using hi-tech c compiler in MPLAB? The slave seems to give ACk when i2c debugger in in connection in proteues.
 

bajra.pradeep

Newbie level 4
Joined
Jan 21, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
here is my code and proteus simulation. please help. even my eeprom doesn't seen to work now
 

Attachments

  • I2C#PICTOPIC.7z
    56.7 KB · Views: 28

bajra.pradeep

Newbie level 4
Joined
Jan 21, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
Can anyone please help me with pic16f877a as slave with pic16f877a as master. Please reply, its an emergency
 

babar_ali

Full Member level 3
Joined
Dec 22, 2010
Messages
150
Helped
37
Reputation
74
Reaction score
37
Trophy points
1,308
Location
Friedrichshafen, Germany
Activity points
2,088
Hi,

Find the attached file. Its a working code for the master and slave device (PIC16f877a to PIC16f877a) code. Proteus file are also there.

enjoy!
 

Attachments

  • I2C.rar
    196.1 KB · Views: 53
  • Like
Reactions: Doom11 and zia

    zia

    Points: 2
    Helpful Answer Positive Rating

    Doom11

    Points: 2
    Helpful Answer Positive Rating

bajra.pradeep

Newbie level 4
Joined
Jan 21, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
i have master to slave transfer in but i am searching for code for slave(PIC16f877a) to master(PIC16f877a) transfer.please reply.
 

babar_ali

Full Member level 3
Joined
Dec 22, 2010
Messages
150
Helped
37
Reputation
74
Reaction score
37
Trophy points
1,308
Location
Friedrichshafen, Germany
Activity points
2,088
Hi,
Read about I2C communication from https://www.i2c-bus.org/slave/. After reading you will understand how to trasfer data from a slave device to master device.
The slave cannot start a message, it can only respond to a message initiated by a master. The master requests a response from a particular slave as defined by the device address byte in the I2C protocol. The slave module answer to the master at the appropriate times as defined by the protocol.

You need to develop the code by yourself.
 
Last edited:

bajra.pradeep

Newbie level 4
Joined
Jan 21, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
does anyone have hardware test videos or help for me for pic to pic connection using i2c. My code is well running in proteus but no expected response is there in real world
 

Joined
Dec 4, 2012
Messages
4,294
Helped
822
Reputation
1,654
Reaction score
793
Trophy points
1,393
Location
Bangalore, India
Activity points
0
Have you pulled-up MCLR pins of Master and Slave? Have you pulled-up SCL and SDA lines high with 4.7K resistors? Post your latest working project files and Proteus file.
 

bajra.pradeep

Newbie level 4
Joined
Jan 21, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
I did all that you have mentioned.ok this is my code for master to slave communication. i have simply sent a signal to slave and that signal is again tranferred back to the master. Master Pic is on the left.Please see the bug and help me set this up in real.
 

Attachments

  • I2C#PICtoPICretry.zip
    140.6 KB · Views: 15

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top