PIC communication


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2009
    Posts
    5

    Default PIC communication

    Alright i'll give you guys the qucik and dirty of what my friends and I are doing, and what we need to figure out.
    And if this is a bad post feel free to let me know and i'll get rid of it if i can.

    We are trying to design a lazer tag system.
    We have seperated it into two components which will do there own things.
    The Vest: Will always wait for incoming IR data
    The Gun: Will only shoot IR data when trigger is pressed.

    What we need to figure out is how to communicate between the two, say we transmit the 'full ammo' code to the vest, we need to transmit from the vest to the gun, that it should fill it's ammo.

    Thing is, all we can think of are PWM data transfer between the two chips, BUT, there is no way for us to figure out if the gun should be listening for data or not...
    This is a vary stupid problem but i'm bad at designing this thing and my friends are no help.
    I'm also bad at describing it, so if anyone is willing to spend some time with me, I can describe it better.

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


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jul 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Ya, thats what started us off, but there are a few problems:
    1) They are no longer in busniess so we can't get parts
    2) There 'full source code' is actually not even 1/2 of the code needed.
    3) It does not support any of the features we want
    4) Is a single chip system meaning the gun is the vest, giving issues of you being invincible while firing and **** like that.

    This brings be back to my main question, how can we communicate between 2 micro controlers? When one is a dedicated listener (for incoming IR) and the other is a transmitter.
    Note, we will be having 2 wires going between the chips we can use, (we are using 3 but one is a simple sanity wire)

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


    Did you find this post helpful? Yes | No

    Default

    Oh, I did not check if the link was still good... Sorry.

    For communicating between two MCUs with wires is not to difficult. This page has several examples, look at ser2mod.bas and usart.bas for the basics.
    http://melabs.com/resources/samples.htm

    I think for you project I would go with USART because you may want tohave it working with an interrupt.

    To help with the USART calcs and other stuff this is a very handy tool and the link is good.
    http://www.picbasic.co.uk/forum/showthread.php?t=4994

    Now for a really slick way of interrupting.
    http://www.picbasic.co.uk/forum/showthread.php?t=3251

    Let us know if that is any help...
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Thanks for the links, I've read over them and figured a few things out.
    What i'm stuck on now is the math to try and figure out how I can make a timer that ticks every 1 or 10 microseconds. To encode the IR data I need to step in 600 microsecond intervals. I figure if I write an interrupt timer, that does nothing but increase a tick count (c = c + 1) I can check in my main loop of I should stop/start the IR data: If (Count = 60) Then Low IRPin
    should work if Count is incremented every 10 microseconds :/

    I found an Elapsed time Demo but I need something that is at least 10x more accurate then that [ideally 50x-100x more accurate]

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


    Did you find this post helpful? Yes | No

    Default

    Do a forum search for mister e multicalc. Most of us cheat anymore and us it
    Dave
    Always wear safety glasses while programming.

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