PDA

View Full Version : Problem with PICto PIC I2C MASTER-SLAVE



juanen19
- 26th November 2012, 21:36
hello, I have a problem with connection I2C with 2 PICs

I have a PIC16F1933 (Slave) connected to PIC18F2685 (Master) by I2C connection.

My problem is:

SLAVE PIC send to Master value b00001010, master PIC receives this value, all correct, immediately after SLAVE PIC send to Master PIC the value b00001010 and PIC master receives b00000101 (INCORRECT VALUE), immediately after SLAVE PIC send to Master the value b00001010 and PIC master receives b00001010 (CORRECT VALUE), there is a shift and lose the first bit. I have in Master PIC connected a LCD, I see in DEC format: 10,5,10,5,10,5,10.... not 10 constant value because SLAVE PIC send the same constant value b00001010. I have 4k7 resistor in SDA and SCL lines and PIC master working correctly with others SLAVE devices in Read/Write (DS1307) in the program code, my problem is communication with this 2 PICs.

suggestions, help?

juanen19
- 26th November 2012, 22:56
Problem solved, thanks :)

chichara
- 11th June 2013, 02:58
Hi juanen19

I have the same problem with u so i can get into this forum.
But my problem is little bit different, i use pic16F877A to communicate each other as master-slave.
I didn't know how pic as a slave.
And actually i'm new with this PIC and I2C. I have read information about I2C but it's not clear enough for me.
Could you please explain me about I2C in PIC16F877A as master and as a slave?
or would you please show your code, may be i can learn from your code.

Thank You so much.