I have the following code: http://pastebin.ca/1890737 (the include files are the standard HI-TECH libraries) There is a bug with one of the I2C calls so I tried debugging using MPLAB and my PICKit2 clone, but I cannot seem to get stepping working. Of the various odd behaviours from MPLAB when trying to debug, I notice the following: - most often it will apparently free run, even with a breakpoint set on line 41. Pausing it suggests that it is somewhere at the end of the while loop (e.g. around line 113) but no serial data is ever actually sent. Looking at the SFR window the TRIS values are all wrong compared to what is set in the code. - sometimes (once or twice) it will not free run, claiming that debugging has halted with the program counter at 0 - sometimes (once or twice) it hits a breakpoint on the first line of code, but a single step seems to take approx. 1 minute and the little green arrow that shows the current line of code disappears altogether The toolbar is set to DEBUG not RELEASE. The code works as expected if compiled in release mode and programmed straight into the chip (i.e. the error LED lights). I have tried a new 18F2321 on a new board that I soldered up specially. I upgraded to the latest MPLAB and downloaded the OS to my PICKit2 clone (but it was at the latest version already). The disassembly window does have the correct C->ASM mapping and breakpoints do get resolved. I have tried creating an empty project and starting again. The integration of HI-TECH into MPLAB seems to be fine, as I can compile/program correctly. But I cannot debug. Has anybody seen symptoms like this before? Any suggestions would be appreciated. David -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist