Making the Lab X1 communicate with the Lab X2


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Jun 2008
    Posts
    24

    Default Making the Lab X1 communicate with the Lab X2

    Hi,

    I am very new to the world of programming, and am having trouble working with interrupts, specifically with this project I am working on.

    The project is getting the Lab X1 board to communicate with the Lab X2 board using only one wire (as I need to then apply what I learn to a different project where I only have one I/O pin to use) it is only a one way communication. What I want to do is;

    Upon pressing switch one or two on the Lab X1, either LED 2 or 3 will light up on the Lab X2 as long as the switches are pressed.

    As far as I can tell, I need the have a interrupt on the receiving chip to handle which light to turn on, with the interrupt being initiated externally, unfortunately I am not entirely sure how to do this. I also have very little idea on how to do the serial communication between the two chips...I have spent hours in RTFM sessions, with little to show for it.

    I am wondering if anyone here could point me in the right direction with some stupid simple guides on external interrupts, or possibly show me some sample code and explain how it works...For some reason, all the books I have read out of don't make much sense to me when it comes to these things.

    Thank you,
    Matt

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MatthewM View Post
    I am very new to the world of programming, and am having trouble working with interrupts, specifically with this project I am working on.
    The big question is...what else have you done so far that is remotely related to a project like this?

    Upon pressing switch one or two on the Lab X1, either LED 2 or 3 will light up on the Lab X2 as long as the switches are pressed.
    Then forget the interrupts and just 'make it work' without the interrupts, poll for the 'commands', wait for them, act on them, and keep going.
    When that all works, THEN add the interrupts.

    And when you do get around to adding interrupts, forget about having 2 PICs talk to each other with an interrupt based system. Make one PIC respond to a button press THRU an interrupt rather than just polling. Then make it send out a 'command' when interrupted by a button press.
    Once you figure that out, it's a simple matter of getting a serial input to trigger an interrupt and do what you want.

  3. #3
    Join Date
    Jun 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    I say I am very new to programming because I have about three weeks into learning it, I was offered a job from my father to write the programs he uses in various applications, as such, I am trying to learn it as fast as humanly possible. I have done several sample projects pertaining to both interrupts and serial communication that where in the various books I have collected to learn PicBasic Pro, it's just serial communication and interrupts don't make much sense to me, from the information I have...Even after reviewing it several times. I think it's just a lack of understanding the concepts behind the two, which is why I am looking for more resources on them.

    Right now, whats hanging me up more than anything is the serial communications...I have had a hard time finding sample programs of two PICs interfaced with one another.

    Ideally I would like to find two sample codes for making Lab X boards talk to one another.

    Thank you,
    Matt

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MatthewM View Post
    Right now, whats hanging me up more than anything is the serial communications...I have had a hard time finding sample programs of two PICs interfaced with one another.
    A little bit of searching on these forums, right here, the PicBasicPro forums, the little search button at the top of the screen, blue background, white lettering, with a little downward facing arrow next to it, will get you a long way.

    You don't need an example of "2 Lab X boards talking to each" specifically, you only need an example where a PIC, any PIC, talks to another PIC, any PIC, thru some method.

  5. #5
    Join Date
    Jun 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Thank you for the advice,

    Yes, I realize I don't need that specific of a program, it would just be ideal, since I could then easily implement it on my desk, and see the end results of how it worked.

    I am also searching through the forums, I was just curious if anyone knew of some off site resources as well, since searching Google has yielded me little or happened to know of something offhand that I may have missed in my searches, also, I figured I would put my situation out there in case there was a simple answer to it that I was just missing (I can't count how many times I have been hung up on something for hours, only to find the simplest, most obvious solution).

    Matt

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MatthewM View Post
    Yes, I realize I don't need that specific of a program, it would just be ideal, since I could then easily implement it on my desk, and see the end results of how it worked.
    I am also searching through the forums, I was just curious if anyone knew of some off site resources as well.................
    Matt
    That's what I'm saying...there is a complete example of 2 PIC communication here...on this site...done by one of the most advanced members of this forum (no, not myself, obviously). I don't know what the thread is called, can't remember the title, but it's complete. And most likely you'll have to change it to match your PIC, your hardware, your needs.

  7. #7
    Join Date
    Jun 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Oh, okay, thank you. I will attempt to find it immediately.

    Matt

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MatthewM View Post
    Oh, okay, thank you. I will attempt to find it immediately.

    Matt
    http://www.picbasic.co.uk/forum/showthread.php?t=573

    Found it...right there in the 'Code Examples' section....half a page down...right there...

  9. #9
    Join Date
    Jun 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Are you referring to the program she wrote for PC to PIC? Or is there another program in this thread for PIC2PIC?

    Thanks,
    Matt

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MatthewM View Post
    Are you referring to the program she wrote for PC to PIC? Or is there another program in this thread for PIC2PIC?
    Yep, you're right...you want PIC-PIC not PC-PIC (missing an eye in there somewhere)
    Try this:
    http://www.picbasic.co.uk/forum/show...=bidirectional
    Then head over to www.rentron.com and snoop around there for awhile.

  11. #11
    Join Date
    Jun 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Sweet, thanks for all the help...I am under quite a bit of pressure to make some progress, any any help is wonderful.

    Matt

  12. #12
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Cool

    Let me guess...
    It's a college/higher educational assignment of some sort...

  13. #13
    Join Date
    Jun 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Actually, no, as I said, it's just something I need to figure out how to do for a code I need to write that will go into one of the micro controllers that my father uses in the controls he sells.

    I am not even in college, I just finished my junior year of High School, I needed a job, so this is what I got...But, I can't get paid until I can do something of value, so I need to learn to be proficient with PicBasic Pro as soon as I can. Because of this, I am under a bit of pressure to learn quickly.

    Matt

Similar Threads

  1. Weird issue with Lab X1
    By Demon in forum General
    Replies: 28
    Last Post: - 25th March 2010, 04:30
  2. Newbie with LAB X1 timming problem
    By schlaray in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th November 2006, 00:30
  3. code conversion
    By saturnX in forum mel PIC BASIC
    Replies: 19
    Last Post: - 3rd October 2005, 17:17

Members who have read this thread : 1

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