Some asm instructions takes 1, some other takes 2 instruction to execute, if you add conditionnal instruction then you mess up everything as they can use 1 OR 2 instructions, hence Code size is not a safe way to evaluate execution speed.
What you want to use is a internal Timer, MPLAB stopwatch OR toggle a I/O then measure it with a scope.
Look at the following, for simple code implementations. Note that you'll need to adjust those to suite 20MHz.
http://www.picbasic.co.uk/forum/show...33&postcount=9
http://www.picbasic.co.uk/forum/show...9&postcount=13
For accuracy, you want to use internal timer instead of Pause/PauseUs. This also allow you to do something else in meantime.
HTH
Last edited by mister_e; - 5th June 2009 at 09:20.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks