Learning PASM, stuck on simple issue...
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
mov st, par 'mov ste, st 'add ste, #400 rdlong P0,st mov P1,[b]st[/b] ' Setup working pointer rdlong Reps,P1 ' Get Repetition count add P1,#4 ' Advance pointer to sequence timing rdlong Dly,P1 ' Get sequence timingYour 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.
mov st, par ' Get starting address mov ste, st ' Adress of 100th element add ste, #400 ' Ste now holds address of 100th element mov P1,st ' Setup working pointer rdlong Reps,P1 ' Get Repetition count (assuming the adress of this was passed in coginit) add P1,#4 ' Advance pointer to sequence timing rdlong Dly,P1 ' Get sequence timingNotes:
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:
zigzag long 14 ' steps in sequence ' ms outs long 11 << 16 | %00000001 ' step 1 long 18 << 16 | %00000010 long 29 << 16 | %00000100 long 47 << 16 | %00001000 long 76 << 16 | %00010000 long 124 << 16 | %00100000 long 200 << 16 | %01000000 long 324 << 16 | %10000000 long 200 << 16 | %01000000 long 124 << 16 | %00100000 long 76 << 16 | %00010000 long 47 << 16 | %00001000 long 29 << 16 | %00000100 long 18 << 16 | %00000010 ' step 14The 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