I have the watchdog timer set to OFF And my program is terminated using the following: stop goto stop -----Original Message----- From: Andrew Warren [mailto:aiw@CYPRESS.COM] Sent: Thursday, February 07, 2002 1:15 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]:What is the best way to end a program WEBB,TIM (A-Sonoma,ex1) wrote: > For development purposes, I have tried two different approaches to > ending a program > > Run the program to "end" or create an endless loop like "stop goto > stop" > > I have noticed that sometimes my 16F877 will just suddenly re-boot or > reset and re-run the program after it has been sitting in either a > endless loop or sent to end. Tim: What, exactly, does "run the program to 'end'" mean? If you're writing in assembly language, there's no such thing as an "end" instruction; the "end" line in your source code is used only be your assembler. Allowing your program to just run into it will cause the symptom you're seeing, since the PIC will keep executing the code in the "empty" code memory locations beyond the last location used by your code, until its program counter wraps around to the reset vector at 0000. If you want to terminate your program with "stop: goto stop", you'll need to ensure that the watchdog timer is disabled (or clear the watchdog timer inside the loop). This code will work: STOP: CLRWDT GOTO STOP -Andy === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics