i''m new, need help with command
Archiver
Posts: 46,084
Yes, the BS2 can do around 3 instructions in a
milli-second (mS). A pretty big main-loop of
50 instructions will still let you check the
buttons every 16 mSec. You might want to
add a little 'software de-bounce' once you see
the button go high -- check 3 times in
rapid succession to see if it stays high.
Also, you CAN check multiple input pins at the
same time with "INA" "INB", "INC", etc.
"INA" for instance reads pins 0,1,2, and 3
into a variable. See the manual for more.
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> 500 milliseconds is forever in microcontroller terms, especially in
a
> small tight loop. So long as you can ignore other inputs while
you're
> processing what's currently active, you won't have any troubles. If
> input processing is short, you can even structure it like this:
>
> Main:
> DO
> IF (Button1 = 1) THEN
> ' button 1 instructions
> ENDIF
>
> IF (Button2 = 1) THEN
> ' button 2 instructions
> ENDIF
>
> ' more button checking
>
> LOOP
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
>
Original Message
> From: andy_watson5 [noparse][[/noparse]mailto:andywatson@m...]
> Sent: Tuesday, February 10, 2004 9:58 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: i'm new, need help with command
>
>
> Well, by "quick", I mean that the pin will only be high for maybe
0.5
> seconds. Assuming that the only thing going is the loop looking
for
> a high on one of the 4 pins, I don't know if that 0.5 sec high is
> long enough. Perhaps I could add some kind of RC circuit to keep
the
> pin latched for an extra second or so. The POLLMODE latching stuff
> looks a little more complicated. But if it's that much better,
I'll
> try to figure it out.
>
> Thanks,
> Andy
milli-second (mS). A pretty big main-loop of
50 instructions will still let you check the
buttons every 16 mSec. You might want to
add a little 'software de-bounce' once you see
the button go high -- check 3 times in
rapid succession to see if it stays high.
Also, you CAN check multiple input pins at the
same time with "INA" "INB", "INC", etc.
"INA" for instance reads pins 0,1,2, and 3
into a variable. See the manual for more.
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> 500 milliseconds is forever in microcontroller terms, especially in
a
> small tight loop. So long as you can ignore other inputs while
you're
> processing what's currently active, you won't have any troubles. If
> input processing is short, you can even structure it like this:
>
> Main:
> DO
> IF (Button1 = 1) THEN
> ' button 1 instructions
> ENDIF
>
> IF (Button2 = 1) THEN
> ' button 2 instructions
> ENDIF
>
> ' more button checking
>
> LOOP
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
>
Original Message
> From: andy_watson5 [noparse][[/noparse]mailto:andywatson@m...]
> Sent: Tuesday, February 10, 2004 9:58 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: i'm new, need help with command
>
>
> Well, by "quick", I mean that the pin will only be high for maybe
0.5
> seconds. Assuming that the only thing going is the loop looking
for
> a high on one of the 4 pins, I don't know if that 0.5 sec high is
> long enough. Perhaps I could add some kind of RC circuit to keep
the
> pin latched for an extra second or so. The POLLMODE latching stuff
> looks a little more complicated. But if it's that much better,
I'll
> try to figure it out.
>
> Thanks,
> Andy