I don't see a clrwdt command anywhere. Make sure the watchdog timer is disabled in the FUSE settings of the PIC, or add a few CLRWDT instructions withing the loops. Without these, the PIC with periodically reset, causing symptoms that you describe. And by the way, comment your own code as you see fit and in your own style. Comments are a personal thing and do not fit in with any rules. Regards Les -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads