i''m new, need help with command
Archiver
Posts: 46,084
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
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> The depends on how you define "quick" and keep in mind that standard
> Stamp inputs are not latched. As Tracy suggested, however, you can
use
> POLLIN instruction with a MODE that will latch polled inputs, but
note
> that using POLL instructions work in between other things (the
Stamp is
> single threaded). In addition to the manual, and information on
Tracy's
> web site, you may find this article helpful:
>
> http://www.parallax.com/dl/docs/cols/nv/vol2/col/69.pdf
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: andy_watson5 [noparse][[/noparse]mailto:andywatson@m...]
> Sent: Tuesday, February 10, 2004 8:58 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: i'm new, need help with command
>
>
> Ah, I see. Thanks for the help. That sounds like it might work.
>
> So if I have an infinite loop looking at the buttons:
>
> Button_Scan:
> IF (ButtonA = 1) THEN BtnA_Sub
> IF (ButtonB = 1) THEN BtnB_Sub
> IF (ButtonC = 1) THEN BtnC_Sub
> IF (ButtonD = 1) THEN BtnD_Sub
> GOTO Button_Scan
> ....
>
> Is this loop quick enough to catch a quick pulse on one of the
> momentary buttons? I just don't know how fast the stamp scans, and
I
> don't want the program to be looking at ButtonC when someone
presses
> ButtonA, but they release it by the time the program gets back to
> looking at ButtonA again.
>
> Thanks,
> Andy
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > You can do this simply and prioritize your scan through simple IF-
> THEN
> >
> > Button_Scan:
> > IF (ButtonA = 1) THEN BtnA_Sub
> > IF (ButtonB = 1) THEN BtnB_Sub
> > ...
> >
> > BtnA_Sub:
> > ' code for button A
> > GOTO Button_Scan
> >
> > This uses an implicit GOTO in IF-THEN. The sample above assumes
> that
> > your inputs are active-high (read a 1 when the button is pressed -
-
> > change to 0 for active low). While this code is a bit "grunt" it
is
> > simple and allows you to prioritize the buttons in the event that
> more
> > than one get pressed.
> >
> > If you want to check all the buttons in order and process those
> that are
> > pressed, you can change your code like this:
> >
> > Button_Scan:
> > IF (ButtonA = 1) THEN GOSUB BtnA_Sub
> > IF (ButtonB = 1) THEN GOSUB BtnB_Sub
> > ...
> >
> > BtnA_Sub:
> > ' code for button A
> > RETURN
> >
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
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
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> The depends on how you define "quick" and keep in mind that standard
> Stamp inputs are not latched. As Tracy suggested, however, you can
use
> POLLIN instruction with a MODE that will latch polled inputs, but
note
> that using POLL instructions work in between other things (the
Stamp is
> single threaded). In addition to the manual, and information on
Tracy's
> web site, you may find this article helpful:
>
> http://www.parallax.com/dl/docs/cols/nv/vol2/col/69.pdf
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: andy_watson5 [noparse][[/noparse]mailto:andywatson@m...]
> Sent: Tuesday, February 10, 2004 8:58 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: i'm new, need help with command
>
>
> Ah, I see. Thanks for the help. That sounds like it might work.
>
> So if I have an infinite loop looking at the buttons:
>
> Button_Scan:
> IF (ButtonA = 1) THEN BtnA_Sub
> IF (ButtonB = 1) THEN BtnB_Sub
> IF (ButtonC = 1) THEN BtnC_Sub
> IF (ButtonD = 1) THEN BtnD_Sub
> GOTO Button_Scan
> ....
>
> Is this loop quick enough to catch a quick pulse on one of the
> momentary buttons? I just don't know how fast the stamp scans, and
I
> don't want the program to be looking at ButtonC when someone
presses
> ButtonA, but they release it by the time the program gets back to
> looking at ButtonA again.
>
> Thanks,
> Andy
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > You can do this simply and prioritize your scan through simple IF-
> THEN
> >
> > Button_Scan:
> > IF (ButtonA = 1) THEN BtnA_Sub
> > IF (ButtonB = 1) THEN BtnB_Sub
> > ...
> >
> > BtnA_Sub:
> > ' code for button A
> > GOTO Button_Scan
> >
> > This uses an implicit GOTO in IF-THEN. The sample above assumes
> that
> > your inputs are active-high (read a 1 when the button is pressed -
-
> > change to 0 for active low). While this code is a bit "grunt" it
is
> > simple and allows you to prioritize the buttons in the event that
> more
> > than one get pressed.
> >
> > If you want to check all the buttons in order and process those
> that are
> > pressed, you can change your code like this:
> >
> > Button_Scan:
> > IF (ButtonA = 1) THEN GOSUB BtnA_Sub
> > IF (ButtonB = 1) THEN GOSUB BtnB_Sub
> > ...
> >
> > BtnA_Sub:
> > ' code for button A
> > RETURN
> >
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...