connect two pics


Closed Thread
Results 1 to 29 of 29

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    14

    Default connect two pics

    Hi to the forum!

    I already searched the forum about how to connect two pics, i found that many ppl suggesting using serin2 and serout2 commands.

    Iam builiding a robot for avoiding obstacles. One PIC16f877a is used for collecting data(actually the voltage is changing) with a/d channels from a sharp IR sensor and display them on a lcd, I want when the sensor gets a minimal voltage value (indicating the robot is close to an obstacle) then the second PIC 16f84 become active (with a l293d chip) to make the dc motors moves the way I want.

    Is there a simpler way to just make the second PIC enable for some minutes to just run the program with the dc motors, and then become inactive again without serial communication?

    I know the simplier solution is to put everything on PIC 16f877a but for some strange reason the big PICs dont work well with l293d and dc motors only the smaller ones like pic16f84 or pic16f628 do thats why i need 2 pics.

    Any help will be very much appreciated.

    Thank you very much.
    Last edited by soki; - 19th September 2008 at 15:09.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    SERIN or SERIN2 is about as simple as it gets.

    Why do you not want to use it?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Find the root cause

    Hi,

    You might want to find out why the big PIC doesnt want to work properly. Do you have a nice and clean supply voltage (or do you get spikes when you start and stop the DC motors)?

    Do you have enough power at all?

    Do you have capacitors close the the power pins of the pic?

    Do you have brown out enabled?

    PCB or a ball of soldered wires?

    X-tal, RC or external oscillator?

    I would reccomend you to try to solve this issue and then you would get a much easier project. There must be a reason for this so I think we keep the 2 pic design as Plan Z.


    What do you mean with "it doen't work well"?
    /me

  4. #4
    Join Date
    Jun 2006
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Thank you for your replies.

    When I say it doesnt work well I mean when I make a program for big PICs and I want for example rotate one dc motor right then pause 2 sec then rotate left pause 3 sec etc, it just dont work or work wrong, for example it will rotate only right and then stop working at all or if its a big loop it maybe stop in the middle of the program.With small pics it works like champion.


    Are there some examples with serial communication? I tried to find the "sixpics" project someone mention but there isn't in melabs program examples.

    Thank you very much.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by soki View Post
    When I say it doesnt work well I mean when I make a program for big PICs and I want for example rotate one dc motor right then pause 2 sec then rotate left pause 3 sec etc, it just dont work or work wrong, for example it will rotate only right and then stop working at all or if its a big loop it maybe stop in the middle of the program.With small pics it works like champion.
    Quite frankly, to me, that just doesn't make any sense. But, I'll bet, I'd just bet, if, and only if, you posted the code that you used in both PICs, the one that worked and the one that failed, you might, just might, get a quick answer as to why one works and the other one seems to fail.
    But that would be just too easy...

    Are there some examples with serial communication? I tried to find the "sixpics" project someone mention but there isn't in melabs program examples.
    Ya know what works for me?
    Typing 'Serial Communication between 2 PICs' in the Search box.
    Crazy how that works ain't it?

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I agree with Jumper, find the problem.
    Maybe post the problem code??

    SERIAL-- really simple example . Much more to add, but the basic idea.
    SEND
    Code:
    SEROUT2, PORTX.X, MODE,[DEC 9]
    RECEIVE
    Code:
    SERIN2, PORTX.X, MODE,[DEC VAR]
    IF VAR = 9 THEN LABELX
    Last edited by mackrackit; - 19th September 2008 at 15:07.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default 877A doh :-)

    If you have connected anything on PORTA and you dont get the results you want.... this one I leave for Melanie to answer if needed :-)

    Show us your HW setup and some code, it should not be rocket science to rotate a DC motor with the 877A.

    So dont give into Plan Z just yet.

    /me

  8. #8
    Join Date
    Jun 2006
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    The program I put in both small and big pics are the same,not different programs! On small pics it work on big not well!

Similar Threads

  1. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 04:59
  2. Retrieving infos from multiple PICs on a bus/chain
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th October 2007, 04:42
  3. connect 2 PICs
    By drama in forum mel PIC BASIC
    Replies: 1
    Last Post: - 4th October 2007, 16:55
  4. Multiple PIC's with 1 crystal
    By puma in forum Schematics
    Replies: 11
    Last Post: - 20th March 2007, 17:02
  5. Replies: 5
    Last Post: - 20th August 2006, 23:09

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