Now I am working on a PIC firmware using 12F629. I am using the internal comparators and the internal comparator reference. There are a bug that under certain conditions, the CMIF flag will stay at 1 even though it should be 0. After some time of manual debugging using a debugging pin, I decide to use ICD2 with the debug header. When running continuously using ICD2, I can repeat the bug. Once I halt the processor, I know that CMIF flag is still 1. Then I let the processor run again, the CMIF flag is correctly changed to 0 and stay at 0 and I can not repeat the bug any more. That is very strange. The same thing happen when I set a break point, once the program halt, the bug is gone. Very very strange. What could cause the problem? Thanks in advance. Regards, Xiaofan -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist