Odd situation on a PIC 16F872: Still coding the pet feeder and things were going along quite nicely, until I added a piece of code and everything freaked out. When it normally starts up, the (4) 7-seg digits show '_' and then goes in to clock mode, counting from 00:01 upwards. With the new piece of code it shows the start-up underscores, then freezes. However, the code is still running. I know this cause I can press the buttons and get some actions out of them (though some behaviors an incorrect now). Also added a blinking LED within the ISR and that shows up even when the code is broken. No WDT. So I commented out the new code (subroutine) and it works again, BUT if I comment out the code that calls the new subroutine (but leave the subroutine in place), it still does NOT work. I've narrowed it down to the existence of the code that causes a problem. I've even changed the new subroutine to 26 nop's (instead of the 26 instructions that were there) with absolutely no calls to it, and it still fails. So now I look at page boundaries, but my total code size is under 600 bytes, and I should not have to worry about paging on a 2K-prog-memory 'F872. Another check for tables crossing the 256-byte boundary and no violations there. Also using indirect addressing in various places, but all addresses pointed to are in bank 0 of data mem so that should not be a problem. I skimmed thru the memory-organization chapter (ch 6) of the mid-range mcu doc again and haven't come up with anything new that could be causing this. Some memory map info: Main code (init stuff and main loop): 0x0005 thru 0x00E2. Subroutines: 0x00E3 thru 0x0020E ISR: 0x020F thru 0x0244 What else could I be neglecting to check here? My next test will be slowly reducing the 26 nops to see when the code works again and see if that leads to anything. After that I may reinstall the MPLAB simulator and try it there. Thoughts appreciated, -Neil. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads