Multiple PICs on usart network


Results 1 to 40 of 52

Threaded View

  1. #22
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172

    Default Re: Multiple PICs on usart network

    Nope, not my video. That's Jose's and he uses transistors. I preferred a software solution, no extra parts involved.

    All Slaves keep their TX line disabled until they are spoken to by the Master and have to send back a reply.


    Quote Originally Posted by Demon View Post
    This post is for the next guy that tries to do this. A few things I learned:

    - you can put a basic MAX232 on the TX and RX lines and "watch" what is being sent around your network.
    - 4K7 pull-up resistors are good for master and slave RX pins (supposedly only necessary in case PIC is disconnected).
    - a structured approach to communication helps, ie: a PIC address, a command, data and checksum.
    - slaves then look at the PIC address and decide if it applies to them, a "calling all slaves" address is also useful.
    - a local command can help support various processing.
    - data can be as big as you need it.
    - and checksum can be as simple as addition of every byte sent, a word variable has more room.
    - RS232 is great for Master to multiple Slaves, as long as only 1 slave replies back UNLESS:


    Code:
    ...
    TXSTA.5 = 1                                 ' Enable USART TX function
    
    HSEROUT (slave sends reply only when spoken to by master)
    
    TXSTA.5 = 0                                 ' Disable USART TX function
    ...
    There's more than one way to skin a cat, but this was by far the easiest to have more than 1 slave on the MASTER RX line. There may still be an issue with this solution, but I have 6 slaves sharing a master RX line right now and they're all purring nicely.
    ...
    The only addition I would add to my list is using a MAX232 on each PICs for stability when using very long cables. It's not known at this point how "long" a network has to be for USART to become "less reliable".

    My project will communicate underground between the house, garage and shed (at least 100' end to end). I plan on using MAX232 chips; it's not like they are expensive.

    Robert


    EDIT: The existing "fried" commercial alarm system has a MAX232, so it's a known solution.
    Last edited by Demon; - 2nd January 2015 at 17:00.

Similar Threads

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

Members who have read this thread : 6

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