Shop OBEX P1 Docs P2 Docs Learn Events
Sixteen-Segment_V1.4 and N64_v1.2 and the XBee Object... — Parallax Forums

Sixteen-Segment_V1.4 and N64_v1.2 and the XBee Object...

TtailspinTtailspin Posts: 1,326
edited 2010-09-04 22:44 in Propeller 1
They just don't seem to be getting along for Me.
Not sure what I am doing wrong... Not even sure of how to ask this question.

I am building My version of a Boe_Bot/Stingray/Scribbler/Thing. Complete with Remote Control.
For the Rolling/Moving Parts,I am Using a USB ProtoBoard,
And a Propeller Professional Development Board (PPDB) is used for the Remote Control.
The Bot moves about nicely, and uses Remote Control from the Xbee/N64 objects
The Nintindo 64 Joystick uses Pin(25), and the XBee is using Pins(23..24),
Everything is/was working well enough, However, it bothered Me that only Three Pins were
being used on the PPDB, Whatever could I use To "Burn Up" some of the other unused Pins..

Oh, I know, how about a nice display on the "Handy" 16 segment led display allready on the PPDB,
that will use a few Pins... Indeed, 23 Pins..
Excellent! now I won't have any of those nasty "unused" Pins looking at Me.
I would just have it simply display "front" for forward, "Back" for Backward,
"Right" For Right turns,ect,ect..

I can make the Sixteen-Segment_v1.4 Demo Send,Scroll,Flash and Clear with no Problem,

But...When I Combine the Three Programs.. Something Just does'nt sit right with the PPDB.
All I get is jibberish and locking/freezing and just general Mayhem on the Display..
It won't Scroll, just displays bizare Char's, Most aren't even letters/Numbers in the string.
or even Letters or Numbers at all, (Kinda neat though, it looks like some alien Alphabet.)

AnyWays, I will post the code for the Remote Control...
(WARNING, the following code was "Written"(cut/pasted) by a Journeyman Carpenter!)
PUB Start ''Start up the XBee and N64 JoyStick
 
led.start(lowChar, numChars, Segment0, true) 'Bring up the display 
   'waitcnt(clkfreq * 2 + cnt)
   'Clear(1) 
 
    'Configure XBee
XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee
XB.AT_Init ' Fast AT updates 
 
'led.start(lowChar, numChars, Segment0, true) 'Bring up the display 
 
XB.AT_ConfigVal(string("ATMY"), MY_Addr) 
XB.AT_ConfigVal(string("ATDL"), DL_Addr) 'set MY and DL (destinaton) address.
 
N64.start(MainStickPin) 'Fire up the Main Joystick
 
'led.start(lowChar, numChars, Segment0, true) 'Bring up the display
 
Scroll(string("Starting and Configuring the XBee Device"), 8) 
 
'SendControl 'Call SendControl
 
MainStick
 
PUB MainStick | i, hello, front, back, right, left 'Main Joystick Operating Commands
 
front := string("Front")
back := string("Back")
right := string("Right")
left := string("Left")
'******************************** Main Joystick Steering *********************************
repeat 
 
    if N64.CU
 
       XB.tx("u") 'send Forward Command to bot Forward(0)
       send(front)
      'waitcnt(clkfreq / 2 + cnt) 
 
    if N64.CD
     XB.tx("d") 'send Reverse Command to bot Reverse(0)
     send(back)
 
    if N64.CR
       XB.tx("r") 'send Right Command to bot Right(0)
      send(right)
I just Pasted a piece of the MainStick Method, the attachment has the complete Code.

Thanks for Your help and Patience.

Comments

  • TtailspinTtailspin Posts: 1,326
    edited 2010-09-04 12:10
    In spite of the poorly written question, I was still serious..

    I would have been less discouraged with an "RTFM" at the very least..
  • Jay KickliterJay Kickliter Posts: 446
    edited 2010-09-04 13:10
    When I run into weird problems like that the cause usually insufficient stack space, especially when using XBees.
  • Roger LeeRoger Lee Posts: 339
    edited 2010-09-04 13:37
    Hello Ttailspin, Are you able to back up a step? What I mean is, will it still "move around nicely" without the new code?

    To state it another way, Can you go back to the last point it was working?
    If so, then we can take it one step at a time.

    Don't pull jumpers from breadboard yet. Just don't use them.
  • TtailspinTtailspin Posts: 1,326
    edited 2010-09-04 13:38
    Thank You Jay,

    It boiled down to just this little bit of code...
    OBJ
      led : "SixteenSegment"              'Sixteen Segment leds Object
     
      s   : "Strings"                     'Object to Make Strings for the SixteenSegment leds
     
      N64 : "N64_v1.2"                    'Main Joystick Object 
      XB  : "XBee_Object"               'Wireless Communications Object
     
     
     
    PUB Start ''Start up the XBee and N64 JoyStick
     
      led.start(lowChar, numChars, Segment0, true)            'Bring up the display
    

    Just putting those four objects and adding the line "led.start(lowChar, numChars, Segment0, true),
    is all it takes to get the alien display...

    I wonder what one of the stacks is not big enough?.(not a well thought out question).

    Anyways, thank You for that, I will go read up on "stacking things" in the Manual.
  • TtailspinTtailspin Posts: 1,326
    edited 2010-09-04 13:48
    If I understand "back up" correctly, The Robot moves about nicely up untill,
    I try to display anything on the Leds, when I try to display anything,
    All I get is "COG SLAP"...:mad:


    So the last working point would be pre display. I can comment out the display,
    and InaPinch rolls around as directed...
  • Roger LeeRoger Lee Posts: 339
    edited 2010-09-04 14:26
    Ttailspin wrote: »
    I can comment out the display,
    and InaPinch rolls around as directed...

    Excellent, so now you have a good place to debug from.
    Ttailspin wrote: »
    All I get is "COG SLAP"...:mad:
    what is COG SLAP???
  • TtailspinTtailspin Posts: 1,326
    edited 2010-09-04 16:19
    Well, with all them Cogs Spinning around in that little tiny plastic chip,
    they are bound to wobble around and "Slap" into each other from time to time...
    (shoulda known better then to trust something without an oil hole!)
    These newfangled modern things, Self lubricating..bah.

    Anyway's, I did fiddle around with setting stack sizes, but not much success.


    I can make different Alien letters predictably, changing different lines in Main.
    but I was hoping for some better direction then the hunt and peck method I've been using.
  • Roger LeeRoger Lee Posts: 339
    edited 2010-09-04 20:28
      front := string("Front")
      back := string("Back")
      right := string("Right")
      left := string("Left")
    

    If it were me, I'd change these one at a time and see what happens.
    For example change:
    front := string("Front") to front := string("Back")

    Now, do commands for forward and reverse display the same? (even if incorrect )
  • TtailspinTtailspin Posts: 1,326
    edited 2010-09-04 21:11
    That is an example of being able to change the Alien writing predictably.

    By commenting out those very four lines, I can make the 2nd from the left led,
    and the 4th from the left led, display an 8 and an Alien e.
    the other led's remaining blank, and no action from the Xbee..
  • Roger LeeRoger Lee Posts: 339
    edited 2010-09-04 22:02
    '******************************** Main Joystick Steering *********************************
      repeat 
    
            
          if N64.CU
          
            XB.tx("u")                      'send Forward Command to bot        Forward(0)
          [COLOR=Red]  send(front)[/COLOR]
            'waitcnt(clkfreq / 2 + cnt)     
           
          if N64.CD
            XB.tx("d")                      'send Reverse Command to bot        Reverse(0)
            [COLOR=Red]send(back)[/COLOR]
            
          if N64.CR
            XB.tx("r")                      'send Right Command to bot        Right(0)
            [COLOR=Red]send(right)[/COLOR]
            
          if N64.CL
            XB.tx("l")                      'send Left Command to bot        Left(0)
            [COLOR=Red]send(left)[/COLOR]
    

    The 4 send(xxxxx) lines above control your LEDs, correct?
    If these are commented, does the robot move as expected?
  • TtailspinTtailspin Posts: 1,326
    edited 2010-09-04 22:44
    That did not have an effect, I think the problem starts just by loading this into ram or eeprom.
    {{
    Code for the Remote Control of InaPinch Robot
     
     
    }}
     
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    '********************************* XBee Section ***********************************************
     
      XB_Rx     = 23                   'Set pins and Baud rate for XBee comms
      XB_Tx     = 24
      XB_Baud   = 9600   
      MY_Addr  = 0                     'Remote Controller Address
      DL_Addr  = 1                    'Robots Address
     
    '******************************* 16 Segment Led Display Pins ************************************
      lowChar  = 0                  'Rightmost character cathode pin
      numChars = 6                  'Number of characters in display
      Segment0 = 6                  'Segment start pin
     
    '******************************* Main Joystick Pin ***********************************************
      MainStickPin = 25                'Propeller pin connected to Signal wire on the N64 Joystick
                                            'Pull up with 1KΩ resistor to 3.3v(vdd)
     
    '******************************* Push Button Control *********************************************
      ' momentary pushbuttons
      'PB7 = 10    'Forward
      'PB6 = 8     'Reverse
      'PB3 = 9     'Left
      'PB2 = 7     'Right
      'PB1 = 4     'QTI_arm_up
      'PB5 = 6     'QTI_arm_mid
      'PB4 = 5     'QTI_arm_down
      'PB0 = 3     'ReadRFID
     
     
    VAR
      'long  dataIn, Value, IO
      'byte  Stack[50]
      'long hello, front, back, right, left  
    OBJ
      led : "SixteenSegment"              'Sixteen Segment leds Object
     
      s   : "Strings"                     'Object to Make Strings for the SixteenSegment leds
     
      N64 : "N64_v1.2"                    'Main Joystick Object 
      XB  : "XBee_Object"               'Wireless Communications Object
     
     
     
    PUB Start ''Start up the XBee and N64 JoyStick
     
      led.start(lowChar, numChars, Segment0, true)            'Bring up the display 
    

    I can comment out the entire rest of the code, and will still get Alien alphabet on startup.

    It seems to come down to the four objects and there associated files.
    and then calling led.start...
Sign In or Register to comment.