END Statement


Closed Thread
Results 1 to 5 of 5

Thread: END Statement

  1. #1

    Default END Statement

    I use the END statement for troubleshooting. Now I find I'm troubleshooting the END statement! The code below stops at the END statement when compiled using PBP, but the END statement is ignored when compiled by MPASM.

    @ device pic12f683, INTRC_OSC_NOCLKOUT, WDT_OFF, MCLR_OFF, PROTECT_OFF

    OPTION_REG = %11000000
    OSCCON = %01100001
    TRISIO = %001100
    CMCON0 = %00000111
    ANSEL = 0
    CCP1CON = 0
    high GPIO.0
    high GPIO.1
    high GPIO.4
    HIGH GPIO.5

    end

    Main:

    high GPIO.5
    pause 1000
    low GPIO.5
    pause 1000
    goto Main

    I use PBP v2.50 and MPASM v5.14. Do I have something set wrong?

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Wink nice playground ...

    Hi, JDerson

    PBP "END" is very different from asm END ...

    just look at the produced asm lines ...

    PBP "END" place processor in SLEEP mode that keeps it from doing anything uncontrolled.

    Code:
     785     310       0063                    SLEEP                                  
     786     311       018A                    CLRF PCLATH                            
     787     312       2B10                    GOTO 0x310

    just for the fun ... add to the top of your program " DEFINE INTHAND _Main" ... w/ underscore !

    and create a PortB.0 ( or else ) interrupt config ...

    What happens ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi, JDerson,

    Look at your program! The program goes through the initialization part then hits END. There is NOTHING that I see that tells the program to got to MAIN except at the end of the MAIN loop. You need to have a line before the END statement that says GOTO MAIN. Then the program will got the Main routine and just continually loop through the MAIN routine until you manually stop the program.

    BobK

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jderson View Post
    I use the END statement for troubleshooting.
    Use STOP instead.

    Compilers get confused when you tell it the END is in the Middle.
    <br>
    DT

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Thank you, Darrel. STOP is the answer!

Similar Threads

  1. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  2. RC5 decode on a 10F + Question
    By ultiblade in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th September 2008, 08:20
  3. Replies: 11
    Last Post: - 12th July 2008, 02:36
  4. ELSEIF Block Would be Good.
    By T.Jackson in forum PBP Wish List
    Replies: 30
    Last Post: - 14th May 2007, 03:36
  5. Replies: 20
    Last Post: - 13th May 2007, 05:10

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