Shop OBEX P1 Docs P2 Docs Learn Events
Multi-Prop ID Process - Make More Simple - Page 2 — Parallax Forums

Multi-Prop ID Process - Make More Simple

2»

Comments

  • jazzedjazzed Posts: 11,803
    edited 2011-06-01 18:43
    Each Prop would be wired to a different ID chip. The program uploaded to all of the Props would include a method that's called right away to read the attached ID chip. The master chip would have a list of all the 48-bit slave IDs, so that it could address each one individually. Subsequent to the program upload, each slave would listen on the bus for its ID before it could respond.

    Because the serial-number is unique, it could be used for communicating a new ID that would take less bits. This would be more useful in a shared bus network like Ethernet. All devices could boot almost simultaneously and broadcast their availability with a back-off algorithm. This would be faster and more reliable than using the one at a time assignment. Performance with too many nodes would suffer in an Ethernet-like HUB/Star network.

    Ring networks would not require these serial-number parts. Redundant path connections would still be necessary for ring topologies in the event of boot failures.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-06-01 19:35
    Sure. Tha master could say something like, "45AD789EFC01, you're number 17. Say 'here' when I call your number." I'm assuming that the various Props have individual characteristics that the master needs to know about. If that's not the case, a back-off response for the sake of simply collecting IDs, without the master knowing which slave has which ID, would work just fine.

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-06-08 10:36
    Ariba wrote: »
    OK, here is a schematic and a possible code:
    attachment.php?attachmentid=81673&d=1306958196
    The idea of the code is: Every Propeller (exept the first) waits until he gets pulses from the previous. The number of pulses is the ID. Then he sends the number of pulses + 1 to the next Prop. This should work also without a crystal. This code is absolutely untested (I don't have 50 Props connected together) !
    VAR
      long id
      
    PUB main
      dira[1] := 1                 'set all P1 to Low
      waitcnt(clkfreq/200 + cnt)
      if ina[0] == 1               'first Prop?
        id := 1                    'first ID
        waitcnt(clkfreq/200 + cnt)
      else                         'other Props:
        ctra := %01010<<26 + 0     'set counter A for pulse counting at P0
        phsa := 0
        frqa := 1
        repeat until phsa > 0      'wait for first puls
        waitcnt(clkfreq/100 + cnt) 'wait while pulses are counted (10ms)
        id := phsa                 'number in phsa
        ctra := 0
        
      repeat id+1                  'send ID+1 pulses via P1 to the next Prop
        outa[1] := 1
        outa[1] := 0
        
    ' now all Propellers should have enumerated itself in 50 * 10ms = 500ms
    
      dira[LEDpin] := 1            'a possible Test:
      repeat id                    'blink a LED on each Prop id times
        outa[LEDpin] := 1
        waitcnt(clkfreq/4 + cnt)
        outa[LEDpin] := 0
        waitcnt(clkfreq/4 + cnt)
    

    Andy

    Andy, thank you sincerely for the diagram and code. Testing with 5 props resulted in the LED on each prop to continue to blink on and off. Is this caused by the code or definitely something else? What is the best way to debug this? Thank you.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-06-08 13:08
    Humanoido,

    I'm don't understand counters well enough to comment much on Andy's code.

    But I'd suggest changing the end of his code from :
      dira[LEDpin] := 1            'a possible Test:
      repeat id                    'blink a LED on each Prop id times
        outa[LEDpin] := 1
        waitcnt(clkfreq/4 + cnt)
        outa[LEDpin] := 0
        waitcnt(clkfreq/4 + cnt)
    
    To:
      dira[LEDpin] := 1            'a possible Test:
      repeat
        repeat id                    'blink a LED on each Prop id times
          outa[LEDpin] := 1
          waitcnt(clkfreq/4 + cnt)
          outa[LEDpin] := 0
          waitcnt(clkfreq/4 + cnt)
        waitcnt(clkfreq + cnt)
    

    This should keep the LEDs flashing the ID numbers.

    Let me know if it doesn't work and I'll try wiring up some Props together to try it out.

    Duane
Sign In or Register to comment.