PDA

View Full Version : Compile error & syntax error on the word "loop:" as a label?



jellis00
- 7th March 2010, 02:52
I am getting a wierd compile error on my PICBASICPRO program in which I am using a loop on a label named "loop:". It also indicates a sytax error on the GOTO statement at the end of the loop. I don't understand why since the word loop is not a reserved word or a PICBASIC coding statement. Can anyone tell me why this would be happening. Here is the code excerpt where this is happening.


loop:
I2CREAD PORTC.4,PORTC.3,$E0,0,[srfver] ' Read version number from srf02
SEROUT PORTC.1,2,[1,"Software v: ",#srfver,13] ' Put it on the screen
I2CWRITE PORTC.4,PORTC.3,$E0,0,[81] ' Request start of ranging
pause 100 ' Wait for ranging to finish
I2CREAD PORTC.4,PORTC.3,$E0,2,[b1,b0] ' Get the ranging results
SEROUT PORTC.1,2,["Range: ",#w0," "] ' Display range data to the screen
PAUSE 100
GOTO loop

Pic2008
- 7th March 2010, 03:02
I have no problem here using "goto loop"

Byte_Butcher
- 7th March 2010, 03:07
I believe that "Loop" is a reserved word in newer versions of PBP.

Use a different label....



steve

jellis00
- 7th March 2010, 03:32
I believe that "Loop" is a reserved word in newer versions of PBP.

Use a different label....



steve
You are right! I had checked all PBP statements in version 2.6 but didn't check Appendix C that lists reserved words....and there it was!

Thanks for catching this!

Darrel Taylor
- 7th March 2010, 04:14
To find LOOP ...

Look at DO.
<br>