Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top