PDA

View Full Version : Need help with "while" error ...



jmlprop
02-05-2007, 03:34 AM
Hello,
I am getting a "while"·error when running the following code on page 118 of the prop manual. Any help would be appreciated. The exact error is
"expected an instruction or varible".

CON
· _CLKMODE = RCSLOW

VAR
· LONG STACK[9]
· Byte Cog

PUB Start(Pin, Delay, Count): Success
Stop
Success := (Cog := cognew(Toggle(Pin, Delay, Count), @Stack + 1))

PUB Stop
· if Cog
··· cogstop(Cog~ - 1)

PUB Active: YesNo
· YesNo := Cog > 0
··
PUB· Toggle(Pin, Delay, Count)
·· dira[Pin]~~
·· repeat
··· !outa[Pin]
··· waitcnt(Delay + Count)
· while Count := - -Count #> -1
· Cog~·

CJ
02-05-2007, 03:36 AM
while is used with repeat on the same line,

repeat while condition

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Who says you have to have knowledge to use it?

I've killed a fly with my bare mind.

Paul Baker
02-05-2007, 03:38 AM
Remove the space between the two - symbols, these should be continuous --. And as CJ has mentioned make sure blocks of code are indented properly.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker (mailto:pbaker@parallax.com)
Propeller Applications Engineer
[/url][url=http://www.parallax.com] (http://www.parallax.com)
Parallax, Inc. (http://www.parallax.com)

jmlprop
02-05-2007, 03:57 AM
Thanks guys, that did it ... I just indented while one space further and it cleared up.