Shop OBEX P1 Docs P2 Docs Learn Events
Arrays in the DAT section — Parallax Forums

Arrays in the DAT section

lassethomsenlassethomsen Posts: 46
edited 2007-04-03 13:19 in Propeller 1
Hi.

I am having this very weird problem with my arrays in the DAT section.

DAT
        'Home position. $FF is to mark the end of the walking table
        Home  
              long $00, leg1Ground, $04, leg3Ground, $08, leg5Ground
              long $02, leg2Raise,   $06, leg4Raise,  $0A, leg6Raise
              long $03, leg2Home,    $07, leg4Home,   $0B, leg6Home
              long $02, leg2Ground, $06, leg4Ground, $0A, leg6Ground
              long $00, leg1Raise,   $04, leg3Raise,  $08, leg5Raise
              long $01, leg1Home,    $05, leg3Home,   $09, leg5Home
              long $00, leg1Ground, $04, leg3Ground, $08, leg5Ground
              long $FF

        Blah
              long $00, leg1Ground, $04, leg3Ground, $08, leg5Ground
              long $02, leg2Raise,   $06, leg4Raise,  $0A, leg6Raise
              long $03, leg2Home,    $07, leg4Home,   $0B, leg6Home
              long $02, leg2Ground, $06, leg4Ground, $0A, leg6Ground
              long $00, leg1Raise,   $04, leg3Raise,  $08, leg5Raise
              long $01, leg1Home,    $05, leg3Home,   $09, leg5Home
              long $00, leg1Ground, $04, leg3Ground, $08, leg5Ground
              long $FF        




If i use the Home array, my legs are homed as i wantede them to be.
But if i use the Blah array one legs starts with moving to a max position (Servo 01 goes to 0 value), even though Blah is a copy/paste of Home. But after one leg has moved to the max position the legs are homed.
But i comment out those two lines from the Home array
              long $00, leg1Ground, $04, leg3Ground, $08, leg5Ground
              long $FF


There is no problem with one legs moving to the max position before getting homed.


If i only commeny out the long $FF linie, its Servo 03 that goes to 1200.

Im communication with my Servos/legs trough the Parallax ServoController.
I have attached the full source code for the file.

To me it looks like som memory violation, but i really cant figure out where the mistake is, so can anybody help me?

Comments

  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-04-03 10:35
    Well I'm not really sure but as it is a copy and paste and you are running the same code it seems it must be related to the way you are writing out your DAT block, perhaps you are getting lucky with the home table.

    In every other program I can find the DAT block is put at the end of the program and the labels are put as far left as possible and on the same line as the start of the block of data.

    I have no idea why this might make a difference but it has got to be worth a go.

    Graham
  • lassethomsenlassethomsen Posts: 46
    edited 2007-04-03 10:45
    Just tried to move the DAT block at the end of the program and the labels far to the left, but no succes. I also tried moving the start of the block onto the same line as the label, no luck.
    Any other ideas?
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-04-03 11:09
    My only other suggestion would be to echo the values for servo and position onto a TV or terminal and see if you can work out what it is doing from that.

    graham
  • lassethomsenlassethomsen Posts: 46
    edited 2007-04-03 12:45
    Unfortunately i "only" have a propstrick Propeller so i cant connect it to a terminal or TV.

    Any other ideas?
  • simonlsimonl Posts: 866
    edited 2007-04-03 12:47
    Just a long-shot -- not sure if this'll help?

    At line 102 you have Walk(@Blah), but the PRI Walk method at line 114 says Walk(_Walk). Then, at line 116 you have m_Walk := @Blah; shouldn't that read m_Walk := _Walk?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon

    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif

    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
  • lassethomsenlassethomsen Posts: 46
    edited 2007-04-03 12:52
    As i understand SPIN my method takes a parameter named, _Walk, but I overrule that i linie 116 when directly setting my m_Walk to @Blah.
  • lassethomsenlassethomsen Posts: 46
    edited 2007-04-03 12:55
    So I think i maybe have solved the issue, the m_Walk variable is a byte, but after i changed it to a long i dosnt act up currently.
  • simonlsimonl Posts: 866
    edited 2007-04-03 12:59
    Aha! Well spotted smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon

    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif

    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
  • lassethomsenlassethomsen Posts: 46
    edited 2007-04-03 13:01
    Yeah it was a though one, been working ~24 hours on that single error.
    But shouldnt i could store a adressepointer to my array in a byte?
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-04-03 13:19
    Ah ha!

    A byte will only hold a number up to 255 so it is not surprising that it wasn't man enough for the task. Hub ram is addressed by the byte so you would be up to 168 by the end of the home block.

    Take a look at this thread:

    http://forums.parallax.com/showthread.php?p=621981

    It shows my propstick development set up, notice that I make the connection for TV using a special cable with the resistor network built in.

    Graham
Sign In or Register to comment.