Loop counter doesn't reset

Moderator: Benj

Post Reply
Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times
Contact:

Loop counter doesn't reset

Post 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
Attachments
Loop Example.fcf
Loop example
(6 KiB) Downloaded 390 times
The only real simulation isn't ...
Gypo

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Loop counter doesn't reset

Post by medelec35 »

Edit: Work around not required. Tested and Steves right of Course :p
Last edited by medelec35 on Fri Nov 12, 2010 3:43 pm, edited 1 time in total.
Martin

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Loop counter doesn't reset

Post 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!

Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times
Contact:

Re: Loop counter doesn't reset

Post 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
The only real simulation isn't ...
Gypo

Post Reply