I don't follow... can you give a quick example?
I don't follow... can you give a quick example?
In most programming languages, when you GOSUB, a number of registers get stored in memory to free them up for use by the subroutine. When you RETURN, those values are put back so the program can continue where it left off. When you GOTO out of a subroutine, the registers are not restored. If you did this when writing a program in a Windows or Linux environment, where the values are store in program RAM, the memory is not released when you GOTO out of the subroutine. This is called a memory leak in your program. Do this often enough, and all the RAM is used and not released until a reboot. It's a good habit to always return from a GOSUB with a RETURN to prevent this.
I had a similar routine once and it worked fine, until the 23rd time pressing the button it would cause the pic to reset. As Demon said, just have the button set a bit to 1 then return. Immediately after the gosub check if the bit is a 1 and if it is then goto wherever you want.
Shawn
OK, got it. Thanks to everyone for the input.
Bookmarks