Making two PIC's talk to each other

Thread Starter

andy24691

Joined Nov 25, 2010
42
I have to come come up with a PIC circuit that does the following.
-Two pics, each of which have two data switches as inputs.
- Each PIC should be capable of transmitting this data serially to the other PIC.
- Each PIC should be capable of receiving this data and displaying it on two LED's.

I'm doing this in machine code, I have a reasonable grasp on the basics of it but have difficulty when it comes to putting it all together and am a little overwhelmed at the moment. Could you please give me an idea how data can be transferred from the input of a PIC and put across to an o/p i.e. taking the data from the switches and outputting it serially.

Here is a crude diagram showing what I'm trying to do.
 

beenthere

Joined Apr 20, 2004
15,819
It looks as if you simply wish to transmit two switch states to the other microcontroller. Do you want to follow an established protocol? PIC's come with interfaces to support several serial communications protocols.

If you simply want to send the state of the switches in a output pin to input pin, think of how you could compose a serial word that could send that data. I imagine the LED's give the state of the other PIC's switches.
 

MattQ87

Joined Apr 5, 2011
13
Sounds like you would want to use two pics that have either UART or SPI interfaces. How large is the distance separating the two? From what you've described, it sounds like they're in close proximity. For longer distances, I would recommend ethernet, usb, RS242 or RS485, depending on what is most convenient. If there is one thing MCUs have plenty of, it's communication standards.
http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter
http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
 
Top