Communication PIC to PIC?


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84

    Default Communication PIC to PIC?

    How do I transfer a value (variable) from one PIC to another? Say w2=25 for example. I now use the SERout command to output an LCD display. Would this be the method, SEROUT and SERIN? How to set this imported value into the recieving PIC variable using PICBasic?

    Thanks,
    James

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


    Did you find this post helpful? Yes | No

    Default

    Master:
    SEROUT SerPin,Baud,[YourVar]

    Slave:
    SERIN SerPin,Baud,[YourVar]

    ---- OR ----

    Master:
    SEROUT SerPin,Baud,[#YourVar]

    Slave:
    SERIN SerPin,Baud,[#YourVar]

    ---- OR ----

    Master:
    SEROUT2 SerPin,Baud,[DEC YourVar]

    Slave:
    SERIN2 SerPin,Baud,[DEC YourVar]

    ---- OR ----
    .
    .
    .
    .

    ---- OR -----
    .
    .
    .
    .
    Steve

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

  3. #3
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve, I'll give her a try.
    James

  4. #4
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    what do you do if you have 39 things to send and you do not want to eat up all that space with serin commands.

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


    Did you find this post helpful? Yes | No

    Default

    39 things to send or receive?

    To send => you can even use internal EEPROM or use an array variable.

    To receive = > With SERIN2, look for the STR modifier.
    Steve

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

  6. #6
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    ok. I think that I have found a way to get this moving. The problem that I have is that I broke my 16f648a and do not have another. I will be waiting for a while. But between what I have I think that it will work.

    I have the programs of my work if you want to look. ironing out the little details to trans u2 ver 7 and still working on trans u1 ver2.

    Ah quick question. the attachment MATH is part of u1 ver2. I am getting error leaving me to understand that I don't understand the math behind what is happening within the chip. Since I am doing multiplication and division my information is base 32 rather than 16? Is that what I am to understand?
    Attached Files Attached Files

  7. #7
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    Master:
    SEROUT SerPin,Baud,[YourVar]

    Slave:
    SERIN SerPin,Baud,[YourVar]

    ---- OR ----

    Master:
    SEROUT SerPin,Baud,[#YourVar]

    Slave:
    SERIN SerPin,Baud,[#YourVar]

    ---- OR ----

    Master:
    SEROUT2 SerPin,Baud,[DEC YourVar]

    Slave:
    SERIN2 SerPin,Baud,[DEC YourVar]

    .
    SerOut B.6,N2400,[w2]

    SerOut B.6,N2400,[#w2]

    Referrrencing my above example, both get "bad expression" errors when compiling, whats wrong?
    James

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


    Did you find this post helpful? Yes | No

    Default

    What about
    Code:
    SerOut PORTB.6,N2400,[w2] 
    
    SerOut PORTB.6,N2400,[#w2]
    Steve

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

  9. #9
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Sho Nuff! Thanks Steve.
    James

  10. #10
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84


    Did you find this post helpful? Yes | No

    Default sync data transfer?

    After being unsuccessful in transferrring the data from master to server, I now realize there must be some timing issues involved. How to time the transfer, or have slave wait until a successful serin has been made?
    James

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 : 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