Serial comm between two PICs


Closed Thread
Results 1 to 25 of 25

Hybrid View

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

    Default Re: Serial comm between two PICs

    Hi,
    Again, saying "it doesn't work" really does not make it easy trouble shooting someone elses code from a remote location. You really need to figure out WHAT isn't working. Where is the problem, is it the sending PIC or the receiving PIC? Perhaps the communication is working just fine and it's the fact that your sending the same value all the time that's making it LOOK like it's not working? How are you determining that it's not working? What does it do?

    One thing I did notice, in your previosuly posted code, is that you're using DEFINE DEBUG_XXXX on the receiving side as well. You need to use DEFINE DEBUGIN_XXXX.

    Another thing I'd do is implement some sort of delay, or even handshake, so that the sending PIC sends the value ONCE each time instead of sending it over and over again as fast as it possibly can.

    /Henrik.

  2. #2
    Join Date
    Dec 2010
    Posts
    409

    Default Re: Serial comm between two PICs

    I've also found it useful to stick a PC serial port in the middle during development. Set up your PC to run a terminal program, then start with making sure the transmitter and receiver work on their own before trying them together. Divide and conquer.

  3. #3
    Join Date
    Oct 2013
    Posts
    9

    Default Re: Serial comm between two PICs

    Quote Originally Posted by HenrikOlsson View Post
    your sending the same value all the time that's making it LOOK like it's not working?What does it do?
    /Henrik.
    I am shure that the PIC1 is sending the diferent value every time becouse I have LCD out view on PIC1.I am not shure that PIC2 is resiveing the data becouse the adress of PIC2: 00 is allwayes FF.So I must get a logic analiser and see what happens on resive PORTB.1.

  4. #4
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333

    Default Re: Serial comm between two PICs

    Having read the manual the serin statement has this format.

    SERIN Pin,Mode,{Timeout,Label,}{[Qual...],}{Item...}

    As you can see square brackets are around the Qualifier.

    The statement in your code

    SERIN PORTB.1,T2400,[BR]

    Is therefore waiting for BR as a qualifier?

  5. #5
    Join Date
    Oct 2013
    Posts
    9

    Default Re: Serial comm between two PICs

    Quote Originally Posted by EarlyBird2 View Post

    SERIN Pin,Mode,{Timeout,Label,}{[Qual...],}{Item...}
    The statement in your code
    SERIN PORTB.1,T2400,[BR]
    Is therefore waiting for BR as a qualifier?
    I had never use SERIN or SEROUT or DEBUG or DEBUGIN instruction so I can't shurely tell you what' right. I need to send decimal value of GREJAC from PIC1 to BR on PIC2.Then a decimal value of BR I will compare in SELECT CASE rutine which I didn't wrote.

  6. #6
    Join Date
    Dec 2010
    Posts
    409

    Default Re: Serial comm between two PICs

    SERIN PORTB.1,T2400,[BR] should be SERIN PORTB.1, T2400, BR

  7. #7
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333

    Default Re: Serial comm between two PICs

    Are you certain Charlie? I was not sure simply because all the way through this thread everyone has used the [BR] version of the serin instruction. Just goes to show that even experts can make mistakes

  8. #8
    Join Date
    Dec 2010
    Posts
    409

    Default Re: Serial comm between two PICs

    According to my manual, yes. (0609)
    I have not tried it. I like SEROUT for transmitting, but generally find using the hardware receiver (HSERIN) easier to get going.

Similar Threads

  1. Pic to pic interrupt ans serial comm
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th May 2008, 23:43
  2. Multiple Pics to One serial port
    By Rleonard in forum Serial
    Replies: 1
    Last Post: - 18th January 2007, 19:30
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 03:21
  4. 16F877, DS18S20 and Serial Comm Problem
    By YellowTang in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2004, 11:36
  5. serial comm from Pic to STAMP
    By d1camero in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th April 2004, 00:58

Members who have read this thread : 0

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