Subroutine problem?

Status
Not open for further replies.

Roger_NO

Member
Hi,

In my assembly code i have about 5 delay subroutines. At the end of these routines i set bit 0 of PORTB high. I have no more code after that point and was wondering if someone knows why my Pic goes back to the start of the program without any goto command? shouldent the led stay lit? forever?


Thank you.
 
The PIC will continue going trough memory and executing instructions (empty memory) until it reaches the end of it's memory space, then it rolls around and starts at 0x00 again.
If you want your pic to "stop" at a certain point you have to do it yourself by creating a endless loop, like this:

Code:
GOTO $    ;$ means the current memory address, so this will loop forever
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…