I attached my program. Can someone tell me what is wrong with the highlited statement, and how can I accomplish the action?
I attached my program. Can someone tell me what is wrong with the highlited statement, and how can I accomplish the action?
Last edited by Russ Kincaid; - 26th May 2006 at 12:55.
Use IF THEN instead
ORCode:IF (Footsw=1) OR (Ready=1) Then Start
Code:While (FootSw=1) OR (Ready=1) LOW RENCA LOW EJECT WEND
Last edited by mister_e; - 26th May 2006 at 12:57.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
First:
Goto should not be used with "While" statement. Use "IF" instead.
ex:
Code:IF Footsw=1 or Ready=1 then Goto Start
Second:
Your statement should have been as below.
Code:While Footsw=1 or Ready=1 Goto start 'cant'be on the same line with While Wend
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Thanks for the replies. I had tried IF - THEN but did not do that right either!
1. Parenthesis are important in most case
2. I would never jump out of a WHILE statement using a GOTO. Using a flag or Validate the Conditions to get out of the WHILE/WEND loop is, IMHO, a better practice.
Could be also..
ORCode:Start: LOW RENCA LOW EJECT While (FootSw=1) OR (Ready=1) : WEND
You may notice that one method generate less code space than the other.Code:Start: LOW RENCA LOW EJECT SpinHere: If (FootSw=1) OR (Ready=1) then SpinHere
Last edited by mister_e; - 26th May 2006 at 13:10.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Here is my problem: I tried the spinhere loop, it works but the following statements are a loop. I want the program to stay in the loop but as soon as either footsw or ready goes high, the program jumps back to the spinhere loop. I don't want it to do that. How do I do it?
Code:SpinHere: LOW RENCA LOW Eject While (FootSw=0) OR (Ready=0) ' ' Do your loop here ' wend goto Spinhere
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I have not explained my problem properly: I want a momentary switch closure (footsw) to cause the program to jump to a loop (freq. I don't want it to jump out of the loop when the switch opens.
Bookmarks