Is there a maximum number of variable pointers that can be passed as parameters
4Alex
Posts: 119
Good afternoon all,
I am passing variable pointers as parameters between objects.
In spin1, I do like this:
In spin2, I do like this:
This work well but if I add one more parameter, say Data10, the propeller becomes unreliable. I've tried increasing the stack but to no avail. Is there a limit to the number of parameters representing a variable pointer that can be passed?
Many thanks for any assistance.
Cheers,
Alex
Post Edited (4Alex) : 9/4/2009 10:00:41 PM GMT
I am passing variable pointers as parameters between objects.
In spin1, I do like this:
if test.start(@Status,@Data0,@Data1,@Data2,@Data3,@Data4,@Data5,@Data6,@Data7,@Data8,@Data9) test.run
In spin2, I do like this:
PUB start(Status,Data0,Data1,Data2,Data3,Data4,Data5,Data6,Data7,Data8,Data9) : okay | retValue StatusPtr := Status Data0Ptr := Data0 Data1Ptr := Data1 Data2Ptr := Data2 . . Data9Ptr := Data9
This work well but if I add one more parameter, say Data10, the propeller becomes unreliable. I've tried increasing the stack but to no avail. Is there a limit to the number of parameters representing a variable pointer that can be passed?
Many thanks for any assistance.
Cheers,
Alex
Post Edited (4Alex) : 9/4/2009 10:00:41 PM GMT
Comments
Thanks for your prompt reply. I am a bit confused about passing pointers, so I might have done something wrong.
In the VAR section of spin1: byte Data0
In the VAR section of spin2: byte Data0Ptr
and then I change a value this way: byte[noparse][[/noparse]Data0Ptr] := 4
My variable Data0 is definitely a byte but perhaps the variable Data0Ptr should be a long? BTW, what exactly is into Data0Ptr: my byte value or the pointer of Data0?
Thanks for your help.
Cheers,
Alex
Post Edited (4Alex) : 9/4/2009 8:17:20 PM GMT
Again, you'd declare all the pointers like Data0Ptr as words and use the pointers the way your wrote (byte[noparse][[/noparse]Data0Ptr] := 4).
Data0Ptr contains the hub address of the variable Data0.
Great. Many thanks for your clear explaination. Now that makes sense.
I have one additional question about the size of what I can pass:
Could I pass a long instead of a byte? Would that work also with a byte array (like Data[noparse]/noparse]10] instead of Data0..Data9). If this is possible, could I just write something like byte[noparse][[/noparse]DataPtr[noparse][[/noparse]0 := 4 ? That would be great because I could use bytemove and bytefill.
Cheers,
Alex