pic to pic communication pic2pic


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2007
    Posts
    26

    Default pic to pic communication pic2pic

    Hello,

    What is the easiest way to communicate between two pics ?
    I want to send data from pic12c672 to pic16f84a using minimum number of pins.
    The data format will be numbers (I am yet to solve my earlier problem of A/D conversion)

    Some examples would be helpful.

    Thanks
    Aftab

    ----------------------
    pic to pic communication pic2pic join two pic serout serin

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Use SERIN/SEROUT or SERIN2/SEROUT2. One wire is all you will need.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Apr 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Smile Found a good tutorial


  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    That looks a lot like the manual.

    There are a couple of things to keep in mind:

    The internal oscillator if your chip has one will not be good enough.
    Baud and parity has to be the same on both ends.
    include "modedefs.bas" needs to be at the beginning of the program.

    The manual has enough examples to get started. If you run into a particular problem let us know.

    The code will look some thing like this.
    Code:
    SEROUT PORTC.4,T2400,[9,DEC 10] ' Sends at 2400 baud TRUE,the character 9and the decimal 10 
    SERIN PORTC.4,T2400,[9],net 'Waits for the character 9 and writes the next value to the variable net.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Hello

    I've got two 16F628A to communicate with SERIN/SEROUT at 2400baud, on 2 wires, and it manage to work. 2400bauds seems to be a safe speed.
    Lots of sync error since my program is doing stuff and is not always waiting for data, but it will respond in less than 2-3 sec at worst case.

    I'm curious about how you would make it work with only 1-wire(for 2 way comm)!? Or is it for 1 way comm only?
    How the port would be set, does it have to be swtiched live from input to output?


    Also, I wanted to know if there's a way to get the PIC going if no wire is connected, as currently it hang the program as soon as it hit SERIN.(even timeout is not triggered).
    Can this be fix by adding resistor or caps between TX and RX?

    Maybe onewire comm will get this

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    The much reliable solution for me would be to choose a PIC with a Built-in USART(like yours) and use interrupt instead of any bit banging solution as SERIN.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Jul 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve

    I'll look into that one day.

    Soo many PIC are availables, with so many features!

    edit:
    woohoo!! just realised what Usart could do!! =)
    Last edited by flipper_md; - 8th October 2007 at 18:21. Reason: einstein called

Similar Threads

  1. 2 PIC, serial communication
    By lightgreen in forum Serial
    Replies: 6
    Last Post: - 21st November 2009, 15:20
  2. PIC to PIC "wired" serial one-way communication - SERIN2/SEROUT2
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th April 2008, 20:02
  3. PIC 2 PIC communication
    By Mario in forum Forum Requests
    Replies: 16
    Last Post: - 28th April 2006, 01:56
  4. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 15:45
  5. Pic to Pic communication?
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th April 2004, 19:41

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