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.
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.
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.