Sorry, but I still do not understand why you think this is a bug?
With the PIC operating at 8MHz, you have an execution speed of 2 million single cycle instructions per second. That's fast..!
If you increment decideInterval on each pass through your loop, of course it will = 600 at some point. And very quickly.
Here's another example;
From Main, through the loop once, then back to Main at 8MHz only takes around 19uS. Now take 19uS * 600 for ~11.4mS.Code:init: decideInterval var WORD TIMEINTERVAL con 600 decideInterval = 0 main: decideInterval = decideInterval + 1 IF decideInterval = TIMEINTERVAL then decideInterval = 0 GOTO Match ENDIF GOTO MAIN Match: ' End up here in approximately 11.4mS GOTO Match END
It takes only ~11.4mS before you increment decideInterval from 0 to 600, and then the IF/THEN statement evaluates as TRUE, and program flow jumps to Match.
Note: I verified this (PBP v2.46). It does not jump to match at 11. Only once
decideInterval = 600.




Bookmarks