Multiple PICs on usart network


Closed Thread
Results 1 to 40 of 52

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612

    Default Re: Multiple PICs on usart network

    Andy,
    Just like Richard says the key is to make sure that the slaves never ever starts to speak without being spoken to. If you have one master and multiple slaves you need to come up with a scheme where the master interrogates the slaves, one by one, and the slaves only speak when asked to speak.

    Most of my experience with this type of thing comes from writing code for MODBUS. With MODBUS there's one master and one or more slaves (or servers as they're sometimes called). The master sends out messages on the bus containing a slave adress, a command and some data like "Slave 2, give me the value of your register number 5 and a checksum). All the slaves gets the message, verifies the chcksum and then determines if the message was for them or not. Only the slave with the adress matching that of the message is allowes to speak and must do so within a certain amount of time or a timeout error occurs. A slave can never start talking unless asked to by the master.

    There are of course other alternatives, like each slave has a "slave select line". The master asserts the slave select line of one slave at the time and the slave sends whatever it needs to send.

    If you need to have multimaster capabillity then perhaps CAN is an alternative.

    /Henrik.

  2. #2
    Join Date
    Oct 2004
    Posts
    448

    Default Re: Multiple PICs on usart network

    http://www.sampson-jeff.com/article/.../int.htm#async

    Please scroll down to figure 3b;

    Looks interesting; Tx, Rx, and perhaps power too, all on 1 line.

    Comments, folks?

  3. #3
    Join Date
    Oct 2004
    Posts
    448

    Default Re: Multiple PICs on usart network

    Also, from the forum, http://www.picbasic.co.uk/forum/showthread.php?t=4292

    Bob talks of a separate line for flow control, but that could be avoided by querying each slave, I guess.

  4. #4
    Join Date
    Oct 2004
    Posts
    448

    Default Re: Multiple PICs on usart network

    Recently, I too needed to connect a couple of nodes to a common controller. I wanted a bus on which I could go on adding slaves "in parallel".

    Also, half duplex was acceptable in my application. This is the outcome: works like a charm along a 20 meter cable run at 9600 baud. I'm sure will run much longer at slower speeds..

    And, comms happen over a single line, so you also save a pin on the pic.

    Hope somebody finds it useful!

    Name:  TxRx multiplex.jpg
Views: 5575
Size:  106.9 KB

  5. #5
    Join Date
    Jun 2013
    Posts
    18

    Default Re: Multiple PICs on usart network

    Quote Originally Posted by ardhuru View Post
    Hope somebody finds it useful!

    Attachment 7684
    Hello Ardhuru

    It is a wonderful idea. I have not already thought about it.

    Great work!

    Would you please share some routine (source code) about your work?

    Andy

  6. #6
    Join Date
    Oct 2004
    Posts
    448

    Default Re: Multiple PICs on usart network

    Thanks, Andy.

    Actually, there's nothing to it, really.

    Just set up the Rx and Tx routines as shown in the graphic (substitute the pin you're actually using in place of the C.6 I've shown) and call Tx before each transmission, and Rx before receiving (or more accurately, after each transmission).

    So, at any time, only one guy is transmitting.

    And, make sure the pin you're using is set for digital I/O, of course.

    Anand

  7. #7
    Join Date
    Jun 2013
    Posts
    18

    Default Re: Multiple PICs on usart network

    Quote Originally Posted by ardhuru View Post
    Thanks, Andy.

    Actually, there's nothing to it, really.
    Hello Anand,

    Thank you very much buddy in advance for your replying me.

    In brief, I am beginner at PIC world, and absolutely not expert such as you bro.

    Would you mind if you share an applicable sample here (for Master and slaves), please?

    I would deeply appreciate for your understanding and most valuable support.

    Regards,

    Andy
    Last edited by andymuller; - 27th January 2015 at 17:47.

  8. #8
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170

    Default Re: Multiple PICs on usart network

    test post to open a closed thread (I have a pending post)

    can be deleted once another post is added (thread auto-closes if I remove this one)
    Last edited by Demon; - 1st June 2024 at 03:34.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  9. #9
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133

    Default Re: Multiple PICs on usart network

    I can post here just fine. I see it opened.

    Ioannis

Similar Threads

  1. PICs in a RS-485 network?
    By atomski in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 12th November 2011, 09:52
  2. Multiple PICS from Same Crystal?
    By WOZZY-2010 in forum General
    Replies: 2
    Last Post: - 6th February 2010, 15:18
  3. Problems controlling multiple pics
    By gandora in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 29th May 2007, 08:59
  4. Multiple Pics to One serial port
    By Rleonard in forum Serial
    Replies: 1
    Last Post: - 18th January 2007, 18:30
  5. Multiple Data on to USART RX pin
    By Squibcakes in forum Serial
    Replies: 2
    Last Post: - 20th July 2006, 00:37

Members who have read this thread : 3

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