Shiftin / pic to pic communication.


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Daniel wrote up a pretty nice example of one master pic talking to two slaves via I2C. This might be of interest, though Dave's suggestion would probably be better for busy pics.

    http://www.picbasic.co.uk/forum/cont...lve-with-a-PIC
    http://www.scalerobotics.com

  2. #2


    Did you find this post helpful? Yes | No

    Default Six PICs talking

    I have a system of three 18F4620 and three 16F88's all chattering away. I needed a peer to peer comms system that is able to tolerate the target PIC being busy for a fairly long time and very minimal overhead to those PICs not actually talking at the time. I use 3 common pins on all PICs. ATTention, ACKnowledge and MeSaGe, ATT, ACK, MSG. These all idle high, pulled up by weak pullups. All the ATT, ACK and MSG lines idle as inputs.

    Before sending, a calling party checks that ATT and ACK are both high then it pulls down ATT and sends a series of ADDRESS bytes. All other PICs routinely check the ATT line and if ATT is high they immediately resume their normal program. If ATT is low they check the MSG line for what address is being called. If ATT is low and MSG has MyAddr then that PIC pulls the ACK line low. All others set a NotForMe flag and return to normal business. The calling party then knows the target has seen the call and so it then sends the data packet. It sends until the ACK line goes high which signals the sender that the receiving party has received an error free packet. When the ACK line goes high, all other PICs not involved in that transmission reset their NotForMe flags.

    There is minimal overhead when there is no active traffic. Each PIC just looks at the ATT line and if low it resets the NotForMe flag, were it high, and skips on to its regular program. I can set the maximum number of tries that a calling party attempts to connect. If that times out I set a "TxPending" flag and get on with the normal program. At a lower rate, the TxPending flag causes the sending party to try again.

    Comms is 9600 with a 4 MHz clock or 57600 bps with 20 MHz clocks. Identical code runs in all PICs and in one PIC16F88 I just run the receive code as that PIC is purely a slave. All other 5 are peers.

    HTH
    BrianT

Members who have read this thread : 0

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