i''m new, need help with command
Archiver
Posts: 46,084
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:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JGciYNpYVZ2dBsNCUDBiLtLqjZ1ovJWvToLIH0rgsa8eQKUcgeo_SlNENYEIzN0Oi2Iay4_TzUWmi_I]andywatson@m...[/url
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....
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:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JGciYNpYVZ2dBsNCUDBiLtLqjZ1ovJWvToLIH0rgsa8eQKUcgeo_SlNENYEIzN0Oi2Iay4_TzUWmi_I]andywatson@m...[/url
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....