The following line of code seems to be causing inexplicable results if((PulsePeriod != 0)) As it is, this "if" block is entered despite the variable "PulsePeriod" having been immediately previously set to 0. Removing the inner parentheses gives different results so I can only assume this is because of a stack overflow (I am assuming that the parenthesised items are pushed onto the stack and then popped off for the final evaluation). Is there anyway I can verify this? This is test code and the parentheses are there because a second comarison is being Logical Anded with this one in the actual code and has been remove to simplify things.
A guess PulsePeriod is not a char PulsePeriod is written by an ISR Correct? Erik
pulse period is not a char (It is a ULONG data) and is written by an ISR, yes ... why do you ask?
I should also mention that the problem continues even if the ISR is disabled.