gedo wrote:
thanx. but i send data from master do not read on slave portB.
master PortC.F3 to Slave PortC.F4 & M PortC.F4 To S PortC.F3 is right shematic.
I'm not sure if you are asking a question here or trying to state something but I'll try to explain a little bit more.
You send serial data from the Master to the Slave using these two lines.
PORTC.F3 is the SCL line
PORTC.F4 is the SDA line
The pin mapping (schematic) should be:
Master PORTC.F3 -> Slave PORTC.F3
Master PORTC.F4 -> Slave PORTC.F4
Those are the I2C lines on the 16F876A.
The slave program takes the serial data from the master, 8-bits, and sets the PORTB output of the slave device based on this.
Example:
-------------
The master sends the following data stream 00110011
The slave would set its PORTB = 00110011
If the slave recieves a "read" command the slave will read its PORTC and compile this into serial data to be sent via I2C to the master.
Note: Bits 3 and 4 of the PORTC data sent from the slave to the master should be ignored by the master because these are the I2C lines.