PDA

View Full Version : END Statement



jderson
- 8th November 2008, 17:11
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?

Acetronics2
- 8th November 2008, 17:46
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.



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

BobK
- 8th November 2008, 23:17
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

Darrel Taylor
- 9th November 2008, 00:38
I use the END statement for troubleshooting.

Use STOP instead.

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

jderson
- 9th November 2008, 14:48
Thank you, Darrel. STOP is the answer!