Hi chiragshetty,
I don't understand how a statement that is executed once in 10000 loops affects the loop time.
I think the float-comparison "if (count > 10000.0)" eats up more time than you think.
You might want to check the lst-file with the assembler code to see what the compiler does with your c-code.
The reason why the loop runs faster when you don't include the "PortC = 0x00" statement:
Since there is nothing in that if-block that influences other variables, the compiler probably optimizes the code (omits that whole if-block).
Check the lst-file to find the "if (count > 10000.0)" Assembler-code... it's probably not there.
Besides:
1) You might want to check whether working with floats can be avoided, usually it's possible to use fixed point operations instead.
2) If you really need to use floats, use a uC with floating point hardware, like the LPC4088, etc...
3) What optimization-level are you running? Setting the optimization on level 2 or 3 can increase the speed dramatically, but you might run into weird compiler-errors like missing switch-statements or the like.
For further explanation, post the lst-files of the two variants if you like.
Cheers,
DBE