View Single Post
  #4   Spotlight this post!  
Unread 09-02-2002, 00:13
s_alaniz s_alaniz is offline
Registered User
#0057 (Leopards)
 
Join Date: Jun 2001
Location: Houston, Tx
Posts: 73
s_alaniz is an unknown quantity at this point
OK you said that "p1_sw_top=0" occurs when the switch is pressed
If that is the case then the first program skips to "turn:" when the button is drepressed and doesn't execute the commands.
(Did you intend "p1_sw_top=1" as in the switch is NOT being pressed?) You said it executes the following commands without a button being pressed.... well that's what's you've got it programmed to do.



SO if you're NOT pressing the top button, and count1 =1 then the program skips to "left:" , fails the "count1=2" test and executes the "relay1_fwd = 1" and " relay1_rev = 0 " commands...reaffirms "count1 = 1 " (which it already is) and falls through the "right:" and "turn:" labels and continues to the rest of the program.
if no button is pushed and count1 is not changed externally, it repeats the sbove sequence.
If you're NOT pressing the top button, and count1=2 then the program fails the "count1=1" test and continues and sets "relay1_fwd = 0" and relay1_rev = 1" reaffirms count1=2 (which it already does) drops through "left:" taed the branch from "if count1 = 2 then right:" goes to "right:" drops through "turn:" and continues on throught the rest of the program.


In the second program... if you're NOT pressing a button, both conditional statements "'if ((p1_sw_top = 0) &~ (count1=2))then turn: " and "if (p1_sw_top = 0) & (count1 = 2) then turn1: " FAIL to branch (because p1_sw_top = 0 is false or "0" unless you push the button) and the program executes all the statements ... well you get the idea.

Anyone read this differently? I get confused easily.

Best wishes


Steve Alaniz


"What good is technology if you can't abuse it?" - Ted Forth