Noob needs some help please...


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    May 2008
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Re: Noob needs some help please...

    I don't follow... can you give a quick example?

  2. #2
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Noob needs some help please...

    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.

  3. #3
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: Noob needs some help please...

    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

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: Noob needs some help please...

    Quote Originally Posted by Neosec View Post
    I don't follow... can you give a quick example?
    Flag=0
    Gosub routine
    If flag = 1 then goto somewhere
    .
    .
    Routine:
    Bla bla bla
    If something then flag = 1
    Return

    Robert

  5. #5
    Join Date
    May 2008
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Re: Noob needs some help please...

    OK, got it. Thanks to everyone for the input.

Similar Threads

  1. PICKit2 vs. JDM (Noob question)
    By loamobn in forum General
    Replies: 4
    Last Post: - 19th September 2010, 18:19
  2. NOOB in need of help
    By studysession in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th January 2009, 23:01
  3. Help a noob out?
    By yasiryassin in forum mel PIC BASIC
    Replies: 2
    Last Post: - 15th January 2008, 06:37
  4. (noob)hello world?
    By m4gill4 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 30th November 2007, 00:23
  5. Uber noob needs clarity!
    By bill12780 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd July 2007, 21:40

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts