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.

Help with PIC-PIC communication

Status
Not open for further replies.

RIP_Polaris

New Member
Hi,

I want to connect 2 (or more, but I'll start with 2) PICs using only one I/O pin on each PIC. They need to detect if they are connected to the other PIC or not.
The PICs I'm using are from the 16F87X[A] family, since I have some limited experience with them.

I don't know how to get them to detect each other (and detect if they got disconnected) while using a shared input/output pin.
Can anyone point me in the right direction?

Thanks!
 
Have a pullup resistor pulling the two input pins high, then one PIC can pull the pin low, and the other detects this happening - the second PIC then does the same to acknowledge it's own presence.
 
Yes, but in the future I may want to have slightly more complex communication.. Are there any protocols that are easy to implement using this PIC? What about serial?
 
One of the best 1wire communications methods is called 1wire. Developed by Dallas Semiconductor and well documented with PIC source examples.
**broken link removed**
 
RIP_Polaris said:
Yes, but in the future I may want to have slightly more complex communication.. Are there any protocols that are easy to implement using this PIC? What about serial?

The method I mentioned can be used as serial, you just use the simple handshaking to check it's connected first.
 
RIP_Polaris said:
Yes, but in the future I may want to have slightly more complex communication.. Are there any protocols that are easy to implement using this PIC? What about serial?


There are several way to have PIC's talk to each other. Selecting the best method depends on how much and type of information needs to be passed, how fast it needs to be sent, if it's two way information sharing or not, how many free pins you have avalible, etc. So your application should determine the best comm method used not visa versa.

I like I2C as many devices use that and the latest Picaxe chips I'm using even has functions for the PIC to be either a slave I2C device or a master device.

Lefty
]
 
Thank you all for your help.

I've decided to go along with a very simple protocol. This includes dumping the send when sensing crosstalk, waiting a random amount of time, and then re-sending. I thought of doing this with an interrupt - can someone please explain how this can be implemented? (i.e. I need to set off the interrupt only for the pin rising during input, not output, and it should sense this in the delay between transmissions).

EDIT: just remembered the RB4-7 pins. From what I understand, they only set off the interrupt when they are in input mode.. Does this mean that they have to always be on input, or will the interrupt still function if I switch between output and input?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top