loop question
Archiver
Posts: 46,084
James-
I'm going to take a guess that you're not using PBASIC 2.5, in which
case the editor considers "do" and "loop" as merely labels. As a
result, it generates no syntax errors but doesn't treat the code
segment as a do-loop. Your Stamp is executing as if the program
source code were:
start:
high 14
pause 1000
low 14
pause 1000
quit:
Grab the latest editor from the Parallax site and specify the PBASIC
2.5 directive.
Regards,
Steve
On 14 Feb 04 at 20:14, pstarckt wrote:
> Just aquired a stamp 'homework' board. I'm working through the book
> and when I tried the 'do-loop' program, it would only run once and
> stop. It would run correctly if I added the for and next modifiers
> but not by themselves as the book says. Is there a misprint and I
> have the syntax wrong? The book program looks like this:
>
> do
>
> high 14
> pause 1000
> low 14
> pause 1000
>
> loop
I'm going to take a guess that you're not using PBASIC 2.5, in which
case the editor considers "do" and "loop" as merely labels. As a
result, it generates no syntax errors but doesn't treat the code
segment as a do-loop. Your Stamp is executing as if the program
source code were:
start:
high 14
pause 1000
low 14
pause 1000
quit:
Grab the latest editor from the Parallax site and specify the PBASIC
2.5 directive.
Regards,
Steve
On 14 Feb 04 at 20:14, pstarckt wrote:
> Just aquired a stamp 'homework' board. I'm working through the book
> and when I tried the 'do-loop' program, it would only run once and
> stop. It would run correctly if I added the for and next modifiers
> but not by themselves as the book says. Is there a misprint and I
> have the syntax wrong? The book program looks like this:
>
> do
>
> high 14
> pause 1000
> low 14
> pause 1000
>
> loop
Comments
and when I tried the 'do-loop' program, it would only run once and
stop. It would run correctly if I added the for and next modifiers
but not by themselves as the book says. Is there a misprint and I
have the syntax wrong? The book program looks like this:
do
high 14
pause 1000
low 14
pause 1000
loop
Any help would be appreciated!
James
loop
to
goto loop
I don't use the stamp much these days, I am sure some of the experts will
correct me if wrong
Just aquired a stamp 'homework' board. I'm working through the book
and when I tried the 'do-loop' program, it would only run once and
stop. It would run correctly if I added the for and next modifiers
but not by themselves as the book says. Is there a misprint and I
have the syntax wrong? The book program looks like this:
do
high 14
pause 1000
low 14
pause 1000
loop
Any help would be appreciated!
James
[noparse][[/noparse]Non-text portions of this message have been removed]
software. Go to,
<http://www.parallax.com/html_pages/downloads/software/software_basic_stamp.asp>
and download "BASIC Stamp Windows Editor version 2.1 Beta"
You probably have an older version now, that is treating "DO" and
"LOOP" as ordinary labels, so the program only runs through once.
The alternative is to replace "loop" with "goto top" and include the
"top" label.
-- Tracy
>Just aquired a stamp 'homework' board. I'm working through the book
>and when I tried the 'do-loop' program, it would only run once and
>stop. It would run correctly if I added the for and next modifiers
>but not by themselves as the book says. Is there a misprint and I
>have the syntax wrong? The book program looks like this:
>
>do
>
>high 14
>pause 1000
>low 14
>pause 1000
>
>loop
>
>Any help would be appreciated!
>
>James