Communicating from one micro to another??


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2006
    Posts
    36

    Default Communicating from one micro to another??

    I am looking to make a controller that will be able to interface to another circuit (I will call this the application circuit). The controller will be able to adjust different variable that would be used to change time settings and other values that the application circuit needs to operate. I would like to also provide as close to real time as possible display on the controller that will tell me what my application is doing.

    The controller will have an LCD screen that will display information. I was thinking I would need to USART or some other function to handle the communication between two micros. I was planning on using the PIC16F687 in both the controller and my application circuit. I have built a circuit which uses a LCD display and can show different settings, such as ON times, Off Times, A to D functionality and I can get the circuit to operate how I want. I need to just add the ability to remotely change variables and how to monitor the application in as close to real time as possible. What I want to see in real time is the reading from an A to D function.

    Does anyone have any suggestions as to implement a form of communication between two micros? Thanks ahead of time for the help.

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Since you will need to communicate in both directions, I do not think anything other then USART would be easy to operate and setup.


    ------------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3


    Did you find this post helpful? Yes | No

    Default PIC to PIC comms

    You do not state any distance or speed restrictions so I assume you have your devices within a metre or so. That means you can work up to at least 100,000 bps with the DEBUG and DEBUGIN commands - assuming 20 MHz crystals.

    I have several applications with three or more PICs chattering amongst themselves. In one case I use a bidirectional data lne with the SERIN/SEROUT commands at 9600 bps. In another I use separated data in and data out lines with the DEBUG/DEBUGIN commands. The DEBUG approach should also be able to use a single shared TX/Rx line. The Master Controller (MC) is a PIC 16F877A as is one of the slaves. The second slave is a PIC 16F88. The slave 'F877A mixes gases while the 'F88 runs a Peltier heater/cooler plus a DS1620 and controls temperature. The MC drives some analyser equipment.

    Usually, each processor has a single bidirectional data line to the other processors. In addition, each processor has two strobe lines between them.

    Whenever the MC needs to send a command temperature to the 'F88 or a desired gas mix to the slave 'F877, it raises the relevant Strobe 1 line. Each slave checks once per loop to see if there is a new command waiting. As soon as the slave sees that Strobe 1 is high it then knows the MC has new data for the slave. The slave raises Strobe 2 and uses a DEBUGIN command with a timeout to load the new command which arrives in a checksum protected packet at 100,000 bps from the MC.

    Likewise, if a slave needs to talk to the MC, it raises Strobe 1 and waits for the other processor to reply by raising Strobe 2. The slave then sends a short checksum protected packet to the MC via the DEBUG command. Except when a command exchange is needed, all PIC to PIC lines are configured as inputs and for safety there is a 330 ohm resistor on all PIC to PIC lines.

    In my case the packets are only a few characters long and data rate is 100,000 bps so the data exchange takes place in a few milliseconds.

    HTH
    Brian
    Last edited by BrianT; - 25th October 2006 at 00:01.

  4. #4
    Join Date
    May 2006
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    I am planning on using PIC16F687s on each end. I was going to have a cable directly connect the two micros which would most likely be only 3 ft long or so. In the future I might try to switch this to using infrared. It is not extremely critical to have instant communication but I thought it would be best. I did not know which way would be best to try to communicate via DebugDebugIN or SERIN/SEROUT.

    When you made a reference to using strobe, do you mean that one of the pins on the micro goes high and waits for a corresponding signal from the other micro to know that it can now send a signal?

    This is what I was thinking but was not sure what to do. I have been mulling the project over in my head. I need to just sit and work it through. Thanks for suggestions.

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


    Did you find this post helpful? Yes | No

    Default

    There's several way to do this. Using USART interrupt or not, Serin/Serout, Debug, HSEROUT.

    It depend of what else you PIC need to do.

    I prefer to use a PIC with a USART at least for the interrupt feature, and the 2 bytes buffer. In this case the extra Strobe/Busy line could be remove.
    Steve

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

  6. #6


    Did you find this post helpful? Yes | No

    Default Strobes

    In the process I am controlling, each micro can have very different cycle times. This variation can easily exceed the buffer time that you get with HSERIN/HSEROUT which is only one character time.

    By using the strobes, which are checked every loop by each processor, I can tolerate these highly variable loop times.

    HTH
    Brian

Similar Threads

  1. How to transfer data from 3 micro to 1
    By amindzo in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th September 2008, 13:36
  2. Ideal backup power for PIC micro
    By emavil in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd March 2007, 00:07
  3. Micro Code Studio - Warning message
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th November 2006, 21:17
  4. micro resources
    By volcane in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 4th May 2006, 21:57
  5. Micro code studio free?
    By Michael in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 17th February 2006, 20:45

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