Making two PIC's talk to each other

Discussion in 'Homework Help' started by andy24691, Apr 11, 2011.

  1. andy24691

    Thread Starter Member

    Nov 25, 2010
    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.
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    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.
  3. Markd77

    Senior Member

    Sep 7, 2009
    Which model of PIC? They have different built in capabilities.
  4. MattQ87

    New Member

    Apr 5, 2011
    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.