Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:05 20 Sep 2026 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 : DO:UNTIL....

Author Message
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 02:35pm 24 Jun 2019
Copy link to clipboard 
Print this post

Well now I remember (RTFM) that it's either DO WHILE:LOOP or DO:LOOP UNTIL but of course I forgot and was scratching my head for a bit. Would it be a good idea to have the interpreter pick-up on this and flag an error message?

My

DO UNTIL Pin(22) = 0 : LOOP

Just sat there looping away.


Board: E100
MM.VER:5.0501
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1772
Posted: 05:10pm 24 Jun 2019
Copy link to clipboard 
Print this post

BTW.

DO WHILE:LOOP or DO:LOOP UNTIL
are explained in the manual.
But this also works:

Do:Loop While Inkey$<>Chr$(ENTER)


Michael


‚My name is Ozymandias, king of kings
Look on my works, ye Mighty, and despair!‘
Nothing beside remains. Round the decay
Of that colossal wreck, boundless and bare
The lone and ...
 
PicFan
Senior Member

Joined: 18/03/2014
Location: Austria
Posts: 133
Posted: 06:14pm 24 Jun 2019
Copy link to clipboard 
Print this post

Maybe . . .


DO WHILE(PIN(22) = 0)
. . .
. . .
LOOP
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 06:29pm 24 Jun 2019
Copy link to clipboard 
Print this post

  PicFan said   Maybe . . .


DO WHILE(PIN(22) = 0)
. . .
. . .
LOOP


Oh sure but that would need to be PIN(22) = 1

I used the other option:


DO
.
.
LOOP UNTIL PIN(22) = 0
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3368
Posted: 02:04am 25 Jun 2019
Copy link to clipboard 
Print this post

  Tinine said   Would it be a good idea to have the interpreter pick-up on this and flag an error message?

This is one of the problems with working in the small memory space of a microcontroller.

There are many, many ways of incorrectly constructing a command and it is impossible to trap them all and still fit in the given flash memory space. Already error checking takes up a lot of space (I guess about 20%) and that is only trapping the obvious errors.

Compilers like C and C++ have the advantage here because they are running on a desktop computer with almost unlimited memory. But then they have other disadvantages as well.
Geoff Graham - http://geoffg.net
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026