HH> I'm leaning towards the volatile specifier on variables, so the compiler HH> doesn't assume the variable is in a register in mainline code when the HH> interrupt routine is changing it in RAM. Also, as I recall, the interrupt HH> was changing a multi-byte variable that was then being evaluated by the HH> main line code. Perhaps part way through the evaluation in mainline code HH> the interrupt changes the variable. Perhaps you can disable interrupts HH> before the evaluation, then enable them after, or disable them, copy to a HH> local variable, enable interrupts, then evaluate the local. HH> Harold I tried with no optimizations even though my C18 version expired and it is not optimizing as it should. It produces the same effect inside VSM. As the hours pass i think more and more Proteus has a bug inside its emulation software. Today it was a bad day for experimenting but i will try it for sure tommorow with real components and real PIC -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist