Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:46 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : LOOP without DO error message...

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 09:31pm 11 Sep 2013
Copy link to clipboard 
Print this post

I've hit another hurdle!

Program stops at line 403 with the message that: "Error: LOOP without a matching DO"

Here is the entire routine:

[code]
If Asc(key$)=148 Then
GoSub MenuBox
Font 2
Print @(40,17) + CLR$(Yellow) "SYSTEM INFO:"
Font 1
Print @(25,60) + CLR$(White) " PROCESSOR: PIC32MX795F512L"
Print @(25,70) + CLR$(White) " SPEED: 80MHz"
Print @(25,80) + CLR$(White) " RAM MEMORY: 128KB (less core)"
Print @(25,90) + CLR$(White) " SYSTEM: 32-bit RictOS 1A"
Print @(25,100) + CLR$(White) " RECOVERY: Watchdog Auto-Reset"
Print @(25,112) + CLR$(White) " STORAGE: Class 6 SD Card"
Print @(25,122) + CLR$(White) " FILESYSTEM: FAT32, 8-dot-3"
Print @(25,132) + CLR$(White) " VIDEO: 240 x 216 4-bit VGA"
Print @(25,142) + CLR$(White) " AUDIO: Stereo PWM output"
Print @(25,152) + CLR$(White) " FIRMWARE: 1A, September 2013"
Print @(25,162) + CLR$(White) " CODE SIZE: 725 lines"
Print @(25,172) + CLR$(White) "WRITTEN FOR: Joe Bloggs"
Print @(70,190) + CLR$(Cyan) "Press any key..."
timer=0
Do
key$=Inkey$
If Len(NET$)<>0 Then
if mid$(NET$,1,6)="[ABCD]" and mid$(NET$,15,1)="_" then goto NetAct
endif
endif
Loop Until key$<>"" or Timer>=20000
GoTo Start
endif
[/code]

I don't understand this one at all, as I DO have a matching loop for the do command...

Line 403 is the one that reads: "Loop Until key$<>"" or Timer>=20000"

What gives?
Smoke makes things work. When the smoke gets out, it stops!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 09:37pm 11 Sep 2013
Copy link to clipboard 
Print this post

Nevermind - too many levels of ENDIF!!!

[code]
Do
key$=Inkey$
If Len(NET$)<>0 Then
if mid$(NET$,1,6)="[ABCD]" and mid$(NET$,15,1)="_" then goto NetAct
endif
Loop Until key$<>"" or Timer>=20000
GoTo Start
endif
[/code]

When I removed the 2nd nested endif, everything has come right, and the code is running without that error now. Still curious why that would throw up a DO/LOOP error - I would expect an "ENDIF without matching IF" kind of error report....
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 09:40pm 11 Sep 2013
Copy link to clipboard 
Print this post

You have a one line if with an endif on the next line.
Make it into a multiline.

if mid$(NET$,1,6)="[ABCD]" and mid$(NET$,15,1)="_" then
goto NetAct
endif


Jim

I was too slow posting....
The interpreter reports the first error it finds. It is not always the spot where the real error is.

Using "format" in MMedit usually shows the nesting errors. (It has saved me plenty of times)

PS: I have been playing with the new MMedit which will have colour printing, multiple tabs and a Linux version.

Its still along way off and I don't have much free time to play for the next few months.

JimEdited by TassyJim 2013-09-13
VK7JH
MMedit   MMBasic Help
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 10:05pm 11 Sep 2013
Copy link to clipboard 
Print this post

Thanks Jim.

Great news on MMedit colour printing, but I hope you were not going to any trouble - printing in colour is nice, but NOT essential!

I should try using the PICAXE editor, to load the MM program, and create a colour PDF from there and print that.

I have been using MMedit most of the day, making changes to the code, and then zapping them to the MM to run the tests. LOVE MMedit. Makes cleaning up the code so easy.

Thanks for the post.
Edited by Grogster 2013-09-13
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024