Accessing a spin variable from PASM
kwinn
Posts: 8,697
HELP!!!! I am trying to access a variable in a spin program (BoomBoxController) from a PASM program (ElapsedTimer) running in another cog. I thought it would be as simple as passing the address pointer, but that does not seem to work. I have gone through the manual and several objects and tried everything suggested with no luck. You can ignore the I/O on the pins in ElapsedTimer. That was added to make sure a cog was actually started and that it ran (it did).
Probably some minor thing I missed, so I am looking forward to one of those duh!! moments.
Any help is appreciated.
Probably some minor thing I missed, so I am looking forward to one of those duh!! moments.
Any help is appreciated.

Comments
RDLONG <cog destination>,<hub source address>
WRLONG <cog source>,<hub destination address>
loop waitcnt target, delta rdlong _time_loc, e_t ' read time value from hub to _time_loc add _time_loc, #1 ' increment the time wrlong e_t, _time_loc ' write back new time value '*********************************************************************************************************************** _time_loc long 0 ' pointer to elapsed time long in hub memory delta long 0 ' time delay in clocks to increment target time by 'delta2 long 0 ' time delay2 in clocks to increment target time by e_t long 0 ' temporary storage for time count in hub ram pins long %11000000 ' select pins 7 and 8 target long 1 ' value for waitcnt instruction to wait forAre you sure? I have the above code and longs in the cog and I think it is correct.
Never mind, I see what you mean.