Learning PASM, stuck on simple issue...
UltraLazer
Posts: 30
Im trying to learn PASM and must be lacking some simple information. In my program:
this works:
And this does not...
Though it is commented out for simplification I am hoping to point "ste" to the 100th element after the address stored in par. in order to wrlong values to to hub at "ste".
I am sure my mistake is embarrassingly simple....
this works:
mov P0,par ' Get data patterns starting address mov P1,P0 ' Setup working pointer rdlong Reps,P1 ' Get Repetition count add P1,#4 ' Advance pointer to sequence timing rdlong Dly,P1 ' Get sequence timing
And this does not...
mov st, par 'mov ste, st 'add ste, #400 rdlong P0,st mov P1,P0 ' Setup working pointer rdlong Reps,P1 ' Get Repetition count add P1,#4 ' Advance pointer to sequence timing rdlong Dly,P1 ' Get sequence timing
Though it is commented out for simplification I am hoping to point "ste" to the 100th element after the address stored in par. in order to wrlong values to to hub at "ste".
I am sure my mistake is embarrassingly simple....
Comments
Your current code snippet loads p0 into p1 then uses p1 as a hub address...however, p0 came from a rdlong, so whatever value happened to be at that location in hub memory will be used as the address in the rdlongs for Reps and Dly.
Hope this helps.
Notes:
I have the code set to eight outputs·for this demo so that I can run in on a demo board.
My sequence data is a bit different. The first element defines the number of steps in the sequence. The step data follows, with the timing (in milliseconds) embedded into the step record (a long). The format for a sequence looks like this:
The timing for the step is offset by 16 bits -- this allows one to create a sequence that has up to 16 active outputs (again, with appropriate mods to the driver). Timing is specified in milliseconds to make sequence creation easy and the start() method takes care of setting the timing within the cog for one millisecond. The start method also allows you to align the sequence anywhere you want. On the demo board, for example, you would set the zpin (of the start method) to 16. The reason for this is that you can use the same sequence data in multiple sequencer cogs with different output pins.
Hopefully, some part of this will be useful for what you're doing.
Merry Christmas!
[noparse][[/noparse]Edit] Updated the sequencer object a bit to better handle bad (0) timing within a step (and a couple other tidbits).
Post Edited (JonnyMac) : 12/12/2009 1:29:23 AM GMT