pic to pic communications


Closed Thread
Results 1 to 5 of 5
  1. #1
    nrtshrdvr's Avatar
    nrtshrdvr Guest

    Question pic to pic communications

    Hello everyone.
    I am new to the programming world and pics. I have been assigned with a project of making 2 16F877 pics comunicate with eachother. one will send a command and the other will do the command and report back that it was done. Is there someone who could explain this to me so I can understand it.


    thank you all for your time

  2. #2
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Exclamation Inverted and NonInverted Mode

    Maybe another question for the FAQ? (Which is looking good!)

    I need some further guidence from the PIC GODS/ess at Melabs....

    I haven't had any luck getting two pics to talk on a very basic level and I think it has to do with the wiring.

    Do the pics need to be wired via a resistor and serial data sent / received in inverted mode?

    Or is a straight wire connection, no inverted mode good enough?

    I just can't get the combination right!

    I've had no problems sending and receiving data with and without a MAX chip to terminal programs.. but pic2pic? #&*@!!!

    Cheers

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Getting two PICs to talk to each other in it's simplest form is ONE WIRE (plus Vss/Ground) connected from one PIC to the other. No other Hardware.


    However, this is a HUGE topic. You can do a posting every day for a year and still not cover everything.

    There are so many variables. A solution encompassing one set of variables, would be totally inappropriate for another.

    Before making any kind of move in any direction you need to be armed with your design criteria...

    1. How far apart are the PICs?
    2. Are they both on the same PCB?
    3. How many wires can you connect between the two PICs?
    4. If not on the same board, are they connected by Cable?
    5. If so, how many wires have you got to play with?
    6. Is the interconnection going to be in a noisy environment?
    7. Are you interconnecting by Laser, Infra-red, Wireless, Satellite or other method?
    8. How FAST does the Data Transfer need to be?
    9. Are you sending a BYTE, WORD or whole heap of Data?
    10. Do you need verification that the Data has been Received?
    11. Is the interconnection Bi-Directional?
    12. If Bi-Directional, is that just for verification of reception or for actual Data flow?
    13. Are the PICs xtal or resonator controlled? All of them?
    14. How many of them are going to be interconnected?
    15. And by what methodology (peer-to-peer, slave-master, token-passing, TCP/IP etc)?
    16. Are the PICs going to be busy doing other things whilst the communication is being transmitted/received or otherwise exchanged? Or are they just sitting there waiting for things to happen?

    That's just a VERY brief (and incomplete) list.

    Answers to the above will probably pose more questions, and only then can you start a plan for getting these things connected and talking.

  4. #4
    nrtshrdvr's Avatar
    nrtshrdvr Guest


    Did you find this post helpful? Yes | No

    Post Thank you for all the info

    Melanie;
    Thank you for the reply. as it stands I have the communications thing going but not how I want it to go. My original plan was to have 2 pics talk to eachother but now I find that I will need to have one talk to a computer through a 9pin serial connection.
    This is the issue now. How to get the pic to recieve the data from the computer and decifer what it means.
    My thought is that serial transfers 1 byte at a time and one command is usually 8 to 10 bytes long
    This is where I am finding it diffuclt to program.

    Any help is always apprecated.
    Thanks
    Tom.
    Originally posted by Melanie
    Getting two PICs to talk to each other in it's simplest form is ONE WIRE (plus Vss/Ground) connected from one PIC to the other. No other Hardware.


    However, this is a HUGE topic. You can do a posting every day for a year and still not cover everything.

    There are so many variables. A solution encompassing one set of variables, would be totally inappropriate for another.

    Before making any kind of move in any direction you need to be armed with your design criteria...

    1. How far apart are the PICs?
    2. Are they both on the same PCB?
    3. How many wires can you connect between the two PICs?
    4. If not on the same board, are they connected by Cable?
    5. If so, how many wires have you got to play with?
    6. Is the interconnection going to be in a noisy environment?
    7. Are you interconnecting by Laser, Infra-red, Wireless, Satellite or other method?
    8. How FAST does the Data Transfer need to be?
    9. Are you sending a BYTE, WORD or whole heap of Data?
    10. Do you need verification that the Data has been Received?
    11. Is the interconnection Bi-Directional?
    12. If Bi-Directional, is that just for verification of reception or for actual Data flow?
    13. Are the PICs xtal or resonator controlled? All of them?
    14. How many of them are going to be interconnected?
    15. And by what methodology (peer-to-peer, slave-master, token-passing, TCP/IP etc)?
    16. Are the PICs going to be busy doing other things whilst the communication is being transmitted/received or otherwise exchanged? Or are they just sitting there waiting for things to happen?

    That's just a VERY brief (and incomplete) list.

    Answers to the above will probably pose more questions, and only then can you start a plan for getting these things connected and talking.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Here's a sample program, thrown together for fun this lunchtime, to demonstrate bi-directional dialogue with a PC running something like Hyperterminal. It runs at 300 baud so almost any PIC will run it without an Xtal or Resonator.

    Yes, whatever you type is echoed back to you as feedback. UPPERCASE and lowercase and cOmBINatIOns are handled with reasonably idot-proof command interpretation...

    You can even use the BACKSPACE Key and have the PIC perform rudimentary line editing.

    The object of the program is to demostrate how commands can be passed from the PC User and acted upon by the PIC.

    PIC has five LED's which can be remote controlled in a variety of ways with commands like ON, OFF, BLINK, SWEEP and BEER. The major commands have sub-parameters which can be added to make control more interesting. Plenty of expansion for you to do your own thing.

    Example:

    ON Switch ON all LEDs
    ON 2 Switch ON LED number 2
    ON 4 7 Switch ON LED number 4 for 7 seconds
    BLINK 1 15 Blink LED number 1 15 times
    OFF 1 Switch OFF LED number 1
    SWEEP 25 Sequentially Sweep all LEDs 25 times

    Try to break it (if you can) by typing combinations of garbage....

    Full instructions in the program comments.

    Melanie
    Attached Files Attached Files

Similar Threads

  1. Replies: 26
    Last Post: - 2nd October 2017, 11:35
  2. PIC to PIC communications
    By droptail in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th March 2006, 16:35
  3. PIC Basic Pro <-> HP-IL communications
    By swr999 in forum Serial
    Replies: 0
    Last Post: - 6th March 2006, 18:30
  4. PIC to PIC communications
    By droptail in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th January 2006, 04:46
  5. PC / PIC communications?
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th September 2005, 17:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts