Outside the Mainloop


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Outside the Mainloop

    Hi,
    Except for the colon in the line GOSUB Init: I don't see any issues with this piece of code. Make sure ALL subroutines ends with a RETURN. If you GOTO something FROM a subroutine then makes sure THAT piece of code ends with a RETURN. That's all the advice I can give you ATM.

    You'd be much better helped if you boil down your ACTUAL code to something small that still shows the error and post that.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: Outside the Mainloop

    I used to write like you, except with the END as commented by Henrik.

    I have since changed to how I've seen countless examples here:

    Code:
    Define variables and stuff
    
    GOTO ProgramStart
    
    Subroutine1:
      bla bla
    RETURN
    
    ProgramStart:
      bla bla
      GOSUB Subroutine1
      GOTO ProgramStart
    END
    Your code "should" work. But I've never had a freaky situation by coding like this yet.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Outside the Mainloop

    GOSUB init not GOSUB init: (which would then be a label)
    MAINLOOP and mainloop are different things.

    Post your actual code and we will help you find the other (likely) typos.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Outside the Mainloop

    MAINLOOP and mainloop are different things
    No, they're not in this case. PBP is not case sensitive.

    /Henrik.

  5. #5
    Join Date
    Apr 2016
    Location
    Plainfield, Illinois
    Posts
    73


    Did you find this post helpful? Yes | No

    Default Re: Outside the Mainloop

    ok - thanks - I will... I'm currently trying to HPWM a set of LEDs with a 12F683 next so I'll give that shot. I havea degree in CS - JAVA and C++, but haven't used it since college. I'm 60 years old this year - not kidding.. never too late.

  6. #6
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Outside the Mainloop

    I stand corrected - labels are not case sensitive. Most other things are, however.

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Outside the Mainloop

    Hi Charlie,

    I'll elaborate a bit further: PBP is not case sensitive. The case of labels, commands, variables, constants, modifiers doesn't matter - not case sensitive.

    It's only the case of the "things" that gets passed directly to the assembler (like anything coming after the keyword DEFINE or if you're using inline assembly) that matters because the assembler (MPASM(X)) IS case sensitive.

    /Henrik.

  8. #8
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Outside the Mainloop

    I checked the manual twice and it agrees with you, however I distinctly remember fixing a bug where I had mixed up capitalized variables and non-capitalized variables. (and I don't think it being passed to the assembler) Nevertheless, sorry for giving bad advice. In this case good form and good function are not necessarily related :-)

Members who have read this thread : 1

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