PIC to Pic Signaling


+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2011
    Location
    Portland, Oregon
    Posts
    203

    Default PIC to Pic Signaling

    I have seen enough information on serial transfers to be sure there are people doing this, I'm just not sure the best way to inform the main controller that a secondary module has data and is waiting to deliver (serial) it.
    .
    What I have is a 12F683 based module that decodes I/R and formats 12 byte commands (1 byte device, up to 10 byte parameters and finally a delimiter) for an 18F4420 based aquarium controller. My questions revolve around interfacing the two
    .
    I know that I can run a line between the two and have the master signal READY (HIGH or LOW) to initiate a transfer if there is a command waiting. I think that using a pull down on the line would provide a more robust means to listen and respond in duplex. Im left wondering, is there a better or standard way of doing this? Is it traditional to use a second line... sort of a RTS line? Is it typical to share a clock signal? Those types of considerations.
    .
    Im not looking specifically for code (not saying no); rather, strategies or best practices or even search hints I cant find anything on this.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,212

    Default Re: PIC to Pic Signaling

    You can certainly implement some sort of handshaking. You can implement a pooling strategy where the main controller sends queries to the slave device, asking if it's got any data OR you couls just have the slave device send the data at will and use an interrupt driven routine to receive it in the main controler. Nothing wrong with either aproach really - as long as it "fits" and works for you.

    /Henrik.

  3. #3
    Join Date
    Apr 2011
    Location
    Portland, Oregon
    Posts
    203

    Default Re: PIC to Pic Signaling

    Suppose I pull a single pin LOW on both Pics with a pull-down resistor then, have the master issue HIGH on the pin for some brief time before WAITing at a SERIN for the preamble byte/s of the serial transfer. The slave, listening, "sees" the high and transmits the stored command sequence TWICE, then returns to listen mode. The master compares the two transmissions and re-issues a HIGH (signaling to resend) if the two do not match, else the pin remains LOW. Slave Repeated (count) readisLOW, the slave resets at a preset value.

    I can't imagine that professionals use terms like "some brief time", but it seems adequate for hobby use. Anyone know better?

    I don't think the time values are critical enough to require formal interrupts. I run a loop on the master that updates the clock every second, the gauges every 5 seconds, the outlets every minute... I haven't timed anything specifically, but I imagine the 1 second loop sits idle 3/4 of the time. The master is running at 32mHz, just because it will and the 683 is running at 4mHz - I could bump it up.

    Thanks for your time--

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,172

    Default Re: PIC to Pic Signaling

    Quote Originally Posted by Amoque View Post
    Suppose I pull a single pin LOW on both Pics with a pull-down resistor then, have the master issue HIGH on the pin for some brief time before WAITing at a SERIN for the preamble byte/s of the serial transfer. The slave, listening, "sees" the high and transmits the stored command sequence TWICE, then returns to listen mode. The master compares the two transmissions and re-issues a HIGH (signaling to resend) if the two do not match, else the pin remains LOW. Slave Repeated (count) readisLOW, the slave resets at a preset value.

    I can't imagine that professionals use terms like "some brief time", but it seems adequate for hobby use. Anyone know better?

    I don't think the time values are critical enough to require formal interrupts. I run a loop on the master that updates the clock every second, the gauges every 5 seconds, the outlets every minute... I haven't timed anything specifically, but I imagine the 1 second loop sits idle 3/4 of the time. The master is running at 32mHz, just because it will and the 683 is running at 4mHz - I could bump it up.

    Thanks for your time--
    If the master, 32Mhz, is running with crystal, but 12F683 is running on internal osc, then the timing between the two may be an issue. But is there a critical comm. timing between the two?
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5
    Join Date
    Apr 2011
    Location
    Portland, Oregon
    Posts
    203

    Default Re: PIC to Pic Signaling

    No, nothing is critical, but there are priorities. Simple, reliable, cheap, must fit in current design...

    The most regular function will be setting the clock to (and from) Daylight Savings Time most likely. A couple of emergency-ish shutdowns would be nice. Else, I suspect, if it took a full minute to adjust the timing of the lights or the run-time of a pump, it would hardly make a difference. Fast enough to be convenient, reliable enough I don't worry about it working - hobby grade.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,790

    Default Re: PIC to Pic Signaling

    Maybe this is of interest to you:

    http://www.picbasic.co.uk/forum/showthread.php?t=15368

    Ioannis

Similar Threads

  1. PIC 18f2550 USB joystick TROUBLE (burnt PIC?)
    By jsags1 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th October 2014, 19:06
  2. Replies: 17
    Last Post: - 16th March 2013, 00:11
  3. Replies: 8
    Last Post: - 19th January 2013, 00:21
  4. serial interface pic 18f452 using pic basic pro
    By syed ahmed in forum Serial
    Replies: 0
    Last Post: - 16th May 2010, 05:46
  5. High Speed Serial Comm PC - PIC and PIC - PIC
    By manumenzella in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 16th January 2007, 22:55

Members who have read this thread : 20

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