dave: i checked the generated asm code, and looks like even if it exits fro= m=20 the second while, it doesn't go back to the start of the program peter v.h. : i declare the delay procedure so when i call it in the main it= =20 knows it has to search for it at the end of the code. however, i can write= =20 all the function before the main block, avoiding the declaration, but the= =20 problem still remains. john: you are right, my programming teacher at high school always scolded m= e=20 for lazy indentation and scarce/non-existant commenting. when i'm working o= n=20 the code i always think "there's no need for it, this is so simple and=20 selfexplanatory!" but if i put it away for a couple of weeks and then look= =20 back at it not only i have a hard time figuring out what it does, but i=20 could also swear that it wasn't me who wrote it :) Should i post code again= =20 in the future i promise it will be presented in a better form. michael: yes, i tried to check the wdte but when i load the .hex file it=20 unchecks. neither had i luck adding a clrwdt maybe it is resetting for hardware causes? how should i check that? -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist