Shop OBEX P1 Docs P2 Docs Learn Events
Accessing parameters in a VAR block as longs — Parallax Forums

Accessing parameters in a VAR block as longs

ciphernetciphernet Posts: 24
edited 2007-07-10 22:09 in Propeller 1
Hi all,

Get a bit of trouble getting this code to work... What am I doing wrong???

I defined a DAT block with LONG values (approx 300 longs) and I get a constant error message: "Size overwrite must be smaller"


(Motor and mot·are defined·as LONG vars in the var section of my SPIN program)

In SPIN:


Motor:=MOTOR_MODE_VALUES.LONG[noparse][[/noparse]mot]


DAT
MOTOR_MODE_VALUES

·LONG·· 0095,0195,0295
·LONG·· 0395,0495,0595
·LONG·· 0695,0795,0895
·etc..


What am I doing wrong???


Jan


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·Give me some slack, please.. I have programmed SX controllers for five years but the prop just blows my mind :-)

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-07 22:48
    MOTOR_MODE_VALUES is already LONG since that's the declaration you're using. I'm not sure why you're getting the message other than that you don't need it. Just use Motor := MOTOR_MODE_VALUES[noparse][[/noparse]mot]
  • ciphernetciphernet Posts: 24
    edited 2007-07-07 22:53
    Hi Mike,

    I have tried that and I am checking the result on my Scopemeter. It seems like nothing happens, but I will have to check my code again. At least I get no error messages anymore.

    Thanks for your reply. Your knowledge·about the prop is amazing.. :-)

    Jan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·Give me some slack, please.. I have programmed SX controllers for five years but the prop just blows my mind :-)
  • KaioKaio Posts: 253
    edited 2007-07-09 13:50
    Following code should work properly.

      Motor:=LONG[noparse][[/noparse]@MOTOR_MODE_VALUES][noparse][[/noparse]mot]
    
    



    The code you was using implies that the variable is an array. But it is declared in DAT section, so you can only access it as address.

    Thomas

    Post Edited (Kaio) : 7/9/2007 1:57:24 PM GMT
  • ciphernetciphernet Posts: 24
    edited 2007-07-10 22:09
    Thanks Thomas, That works

    Jan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·Give me some slack, please.. I have programmed SX controllers for five years but the prop just blows my mind :-)
Sign In or Register to comment.