Page 1 of 1

Loop counter doesn't reset

Posted: Fri Nov 12, 2010 2:22 pm
by Gypo
Hi

In making a project I found a little error (or at least I think it is...)
I had a loop that run 10 times and did certain checks while in the loop, one check could send the program to a connection just before the loop started, hence restarting the loop counting 10 loops again.... or so I thought.

If you send the program back from within the loop when it gets into the loop again it carries on from the count it got to before instead of starting to count 10 loops again.

I have attached a very much stripped down example just to show the point.

As you can see the program is sent to before the start of the loop (an infinate loop). But... the program doesn't do that, it counts the 10 loops and then exits the loop.

Regards

Re: Loop counter doesn't reset

Posted: Fri Nov 12, 2010 3:00 pm
by medelec35
Edit: Work around not required. Tested and Steves right of Course :p

Re: Loop counter doesn't reset

Posted: Fri Nov 12, 2010 3:31 pm
by Steve
Yes - that looks like a bug in the simulation. I think that this program would behave as expected when running on the actual micro.

Thanks for spotting it!

Re: Loop counter doesn't reset

Posted: Fri Nov 12, 2010 3:48 pm
by Gypo
Hi

Thanks for the offer but I don't need a work around.

I didn't try it in the chip, because it wasn't working in the simulation I just did it a different way.
As I was testing the program to see if the rest of it worked and not knowing if that was working would have only confused the tests I was doing.

Regards