Communication PIC to PIC?


Closed Thread
Results 1 to 20 of 20

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    use timeout of SERIN2 or DEBUGIN... PBP manual.
    Steve

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

  2. #2
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    ok I have got the pics that I have been waiting for. I have tried one crued method mentions earlier in the this thread. If I had to set up one pic to wait for the command how would I go about that. That is of course using the SEROUT and SERIN command.

    This is were it starts to get hairy.
    Last edited by Rhatidbwoy; - 30th January 2006 at 22:47.

  3. #3
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hello Rhatidbwoy,

    I have a Master board with 20 slaves connected to it. Actually its 20 masters with 1 slave. The 1 board receives data from the various boards to be displayed and printed out on a POS printer. I have a BUSY line that is normally high. When any board has data to send to the display board it takes the busy line to ground for the duration of the transmission. The display board also takes the busy line to ground and holds it there until someone acknowledges the receipt of the alarm message then it releases then busy line so another message can come in. I'm using SERIN2/SEROUT2 on 16F877A's and my display board has an 18F452. The system has been working great. I also have a remote setup that is smaller with 16F872's in the 20 boards and a 16F877A in the display board. It really took a while to get the serial data stuff working reliably but a gentleman by the name of Steven Collins set me in the right direction. I also got some assistance from MElabs.

    Main loop monitors several points including:
    If BUSY = 0 then GOTO Getdata

    Getdata:
    PAUSE 5
    SERIN2 serpin,36081,300,Main,[Wait ("A"),dec3 B7]

    Upon receipt of the 3 character variable B7, the program now goes thru 320 lines of lookup to find a match thengoes to the display and printing routines.
    The 300ms wait before going back the Main is because I put a response delay of 10 ms on each card so the each card waits 10ms more than the previous card so the last card (#20) will wait 190ms before sending its data. It's simple but effective!

    The project also time stamps the printout, only sounds alarms between 8am and 4:30p Monday thru Friday but always prints. It also prints when the alarm returns to normal. The printer routines use DEBUGOUT.

    Hope some of this helps you.

    BobK

  4. #4
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    can not lie. It is confusing as heck. lol. I will have to read and reread to make sense out of it. It is an idea that is trued that was put together to make work. Instead of 20 different input (19 if 1 is to recieve all of this) I have 2. A master and slave which are both important for what I would like for them to do. I will have to try something.


    You think it would work if I put the reciever into a continuous loop to recieve. When it finishes its recieving phase could I then AND certain portion of data and if it equals itself then move to the rest of the program. In the sense I have 4 parts. check part 1 AND 2, see if that is equal to the recieve value, part 3, then continue to part 4? Just throwing out ideas.

  5. #5
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    SERIN2 serpin,36081,300,Main,[Wait ("A"),dec3 B7]

    could the line above be explain in a little more detail. I follow to what you are to do, but I just do not understand it. I am trying something on my end with SERIN and SEROUT, but I think that I might have to switch to this SERIN2 and SEROUT2. Might make life easier. Who know.

  6. #6
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Rhatidbwoy,

    SERIN2 is fully explained on page 132 of the PBP manual. Serpin is the alias I have assigned to PortA.4 which is where the data will be received. 36081 is the mode of communications I am using derived from the Appendix A on page 201. 300 stands for 300ms which is the timeout for a signal to be received. If no data is received within the 300ms then GOTO Main. Wait ("A") tells the system to wait until the character "A" comes in. This is known as a qualifier. The dec3 tells SERIN2 to convert the decimal value in ASCII and store the value in variable B7.

    I truely am not an expert like some of the other people on this forum and I am sure that they can give a more thorough explaination, but what I learned here comes from the manual and trying different things.

    BobK

  7. #7
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    ok that is great help. The method that I am coming across to use is the HSER--- command.. The USART on hte device. I think that will clarify more to what I need to do, but still the problem with transmitting. I found info about that and it helps more than were I stand.

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