Sendin data from PIC to PIC


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    mastero's Avatar
    mastero Guest

    Default Sendin data from PIC to PIC

    Hello all ,

    This is my first post so hello to everyone here.

    I have two 16f628 and i am using serin and serout for comunication

    chip (1) is master and chip (2) is slave it will just be in a loop to take command.

    chip(1) gets the command from pc rs232 and checks it then sends the command to chip (2) basic port high and port low. thing.

    SERIN PORTA.1 , 84 , [RELAY, DEC STAT]

    above is the rs232 in for chip 1 when the chip1 receives 21 from the pc it refers to RELAY if RELAY is 2 then it send the remaining data in stat to chip 2 for execution so will this work ?

    SERIN PORTA.1 , 84 , [RELAY , DEC STAT]

    IF RELAY = 50 THEN OUTR2

    OUTR2:
    IF STAT = 0 THEN SEROUT PORTA.7 , 84 , [DEC STAT]

    will the above code send the data of stat to the chip2 ?

    Thanx
    Mastero

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Mastero,

    Save yourself alot of work and goto www.rentron.com and look for the project titled "12pin serial I/O interface". It is a project based on the 16F84 and has all the code there that you need to send commands from a PC to the project to control 12 pins on a PIC. This should get you what you want to do.

    BobK

  3. #3
    mastero's Avatar
    mastero Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BobK
    Hi Mastero,

    Save yourself alot of work and goto www.rentron.com and look for the project titled "12pin serial I/O interface". It is a project based on the 16F84 and has all the code there that you need to send commands from a PC to the project to control 12 pins on a PIC. This should get you what you want to do.

    BobK
    I know that, but my problem is not PC to PIC its PIC to PIC

    Its like i have two PIC chips and when the first chips gets a specific info it does nothing but just sends that info to the chip 2 for execution ... chip 2 is always in a waiting loop to receive command from chip 1.

    Mastero
    Last edited by mastero; - 26th November 2005 at 13:59.

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Mastero,

    Okay so you take this concept and have your first PIC send the request to the other PIC. I have a project going on where I have 20 PICs gathering alarm information and they simply send the data to a master board that displays the information on a display and then prints it out on a POS printer. I simply use SEROUT2 from the sending boards and monitor a "busy" line that tells the sender the line is clear and the receiver looks for the "busy" line to go low at which time is enters a SERIN2 routine. The receiver keeps the "busy" line low until the end user acknowledges the receipt of the alarm and then the receiver clears the busy line and awaits any new traffic.

    Is this like something you are trying to do? I just thought that why would you have one PIC receive a command from a PC just to retransmit it to another PIC when one could do the whole thing and eliminate the middle man.

    BoBK

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Without knowing what you are really trying to accomplish -

    I use SERIN, SEROUT (and SERIN2, SEROUT2) extensively to accomplish PIC-PIC communcation.

    Some things to consider:


    Both PICs should be crystal controlled. The internal 4Mhz oscillators usually aren't accurate enough for reliable communication. There are many ways around this, but if you are a beginner, take the easy approach - use a crystal, oscillator or resonator to insure they are both running at a known frequency.

    I assume that you aren't using a level converter (such as a MAX232) anywhere in the system.

    Use a pull-up or a pull-down resistor on the data line between the two parts.
    Use a pull down if you are sending data inverted (recommended), or a pull-up if you are sending data "true". This will help insure that all bytes - including the first one, are received properly. A 10K resistor will work fine.

    Start out at 2400 baud. If you need faster communication, you can later run at up to 38K baud if both your PICs are running at 20Mhz.

    As a debug aid, you can connect the PICs output directly to a PC if you are running in INVERTED mode. This can be a great help in figuring out what is really going on.
    Charles Linquist

  6. #6
    mastero's Avatar
    mastero Guest


    Did you find this post helpful? Yes | No

    Default

    Thanxs guys will work on it and post later..

    Mastero

Similar Threads

  1. Send data PIC to PC
    By konter in forum Off Topic
    Replies: 6
    Last Post: - 25th December 2009, 22:04
  2. Send data to PC USB
    By konter in forum Off Topic
    Replies: 2
    Last Post: - 18th December 2009, 21:57
  3. PIC to PIC Serial data using Cat5 cable
    By Andy Wood in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd May 2007, 02:42
  4. send serial data to PIC 16f84 ausing VB6
    By win_832001 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th March 2006, 21:14
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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