Repeating negative numbers.
Kye
Posts: 2,200
Quick Question: How many times does this repeat?
repeat -1 ' statements
Comments
A long time ago I tried repeat... step -1 and got completely unexpected behavior....
In any event, I suspect the short answer is, "One more time than repeat -2."
-Phil
As far as I know this is a feature that is unique to Spin:-)
@heater - your joking right?
Might be:)
* An empty repeat loop takes about 224 clocks per pass
* So, at 80MHz, the counter variable would be changing at a rate of ~357000 per second
* Monitoring Hub RAM for values that changed at that rate found the counter
* watching the counter showed that it starts at whatever value you specify, so
* starting at -1 will keep going negative at that specified rate, terminating one the counter reaches 0
* at 80MHz, it will take about 3.34 hours to complete an empty "repeat (-1)"
Jonathan
(Why doesn't parallax document this...)
-Phil
So far I know the repeat occurs more than 100,000,000 times (I left a program runing while reading the forums). I think lonesocks answer is better.
Dave