View Full Version : problem repeating
05-08-2008, 08:47 PM
I have a piece of spin code that works perfectly, the idea was to make it run five times in a row, adding repeat 5 and indenting carefully (checked with ctrl-i) and it doesn't work as expected even on the first run through the code, repeat 1 works fine.
How can this be?
05-08-2008, 09:10 PM
Something within the code prematurely aborting the repeat, something locking it up, something corrupting the memory which contains the bytecode, something stopping the Cog running the interpreter. It could be a simple Abort somewhere deep in the code you're calling which doesn't get trapped anywhere.
Anything else you can give which helps the diagnosis ? Does it exit the repeat ? Have you tried using TV_Text or something similar to try and diagnose or watch the progress of the code, have you tried commenting out lines of code and adding them back in to see what screws things up ?
05-08-2008, 09:44 PM
You aren't doing this on an uOLED-96-Prop, are you?
05-08-2008, 10:11 PM
Is your "perfectly working" SPIN code something you cannot post?
05-09-2008, 07:08 PM
Sorry for my rather desperate post, I wouldn't normally have bothered you all but this code is running a PIV experiment (Particle image velocimetry) and we have to be all done by the 12th as the room is being stripped out for renovations.
The code uses some of my own motion control routines, I have two versions of a move, one starts the move then returns once complete, the other starts the move and returns straight away. I was using the latter so that I could monitor its progress by counting step pulses before firing the laser at the correct point.
When I added the repeat it looped to the start of the code interrupting the move with the homing code, it all happens rather quickly so was difficult to spot, I was just wondering if there might have been a common error I was missing related to looping.
05-09-2008, 07:22 PM
I can feel your pressure from here Graham - that post was quite out of character!
Glad to hear you got to the bottom of it http://forums.parallax.com/images/smilies/smile.gif
You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
BTW: I type as I'm thinking, so please don't take any offense at my writing style http://forums.parallax.com/images/smilies/smile.gif