Are any of your variables (e.g. timeOutCNT) modified in an interrupt handler?
If so, ensure that you declare them as volatile
, e.g.
volatile int timeOutCNT;
This prevents the compiler from making optimisations that assume that timeOutCNT is not modified by interrupt handlers or other threads.
Artelius
2010-06-13 08:11:19