i''m new, need help with command
Archiver
Posts: 46,084
Stamps don't need sleep, batteries need sleep.
If you don't have a battery, then leaving the
Stamp in full-power mode all the time is no
problem.
--- In basicstamps@yahoogroups.com, "andy_watson5" <andywatson@m...>
wrote:
> You bring up a good point. When I read Jon's pdf file he linked a
> couple messages ago, I saw that POLLWAIT would let the stamp "nap"
> until a polled event happens. If I don't do the polling option and
> just run the small continuous loop looking for a switch input, is
> there anything wrong with leaving the stamp in 'full power' mode?
> This won't be on battery power, so I'm not concerned with drawing
> down a battery or anything. Would it hurt the stamp to stay active
> all the time and not go into the nap mode?
>
> Thanks
>
> --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> > Hi again Andy,
> >
> > Yes, that straight out scan is going to be simpler than the mind
> set
> > for the POLLing commands. And yes, 0.5 second is forever in
> > microcomputer terms. On the Stamp, each one of those
instructions
> > like
> > > > IF (ButtonA = 1) THEN BtnA_Sub
> > will take about 1 millisecond to execute, so the entire loop to
> scan
> > 4 pushbuttons will execute in well under 10 milliseconds.
> >
> > Note that you also have to allow for the case that someone leans
on
> > one of the buttons. If you don't want the button action to occur
> over
> > and over, you will have to write code to do the action once per
> > event. Take a look at the BUTTON command, which has such
> debounce.
> > However, everyone agrees that with several buttons involved it is
> > more efficient & flexible to write your own code to do that.
> >
> > The simple scanning will be more of a problem if the Stamp has to
> do
> > a lot of other processing at the same time, or if you want it to
> > catch a quick 0.05 second button press or a similar signal that
> comes
> > from an instrument like a tipping bucket rain gage. Or, if the
> > program has to conserve power while waiting for a button to be
> > pressed. The POLLIN latched modes work really well with the
> POLLWAIT
> > command on the BS2pe/pe, so the chip can nap until an event
happens
> > and then test the scratchpad registers to determine which event
(s).
> >
> > You mentioned an RC input network. That can effectively stretch
> > events like the 30 millisecond rain gage pulse. Just a 0.1uf
> > capacitor from the Stamp input to ground, and 270 ohm resistors
to
> > limit the current to the stamp pin and to the switch. The stamp
> pin
> > is an output to charge the capacitor. The program returns about
> once
> > a second to check the voltage on the pin and to refresh it. If
it
> > finds zero volts, that means the switch has closed in the
interim.
> > The Stamp adds one to the count before refreshing the charge on
the
> > capacitor.
> >
> > -- Tracy
> >
> >
> >
> >
> >
> > >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
> > >>
> >
If you don't have a battery, then leaving the
Stamp in full-power mode all the time is no
problem.
--- In basicstamps@yahoogroups.com, "andy_watson5" <andywatson@m...>
wrote:
> You bring up a good point. When I read Jon's pdf file he linked a
> couple messages ago, I saw that POLLWAIT would let the stamp "nap"
> until a polled event happens. If I don't do the polling option and
> just run the small continuous loop looking for a switch input, is
> there anything wrong with leaving the stamp in 'full power' mode?
> This won't be on battery power, so I'm not concerned with drawing
> down a battery or anything. Would it hurt the stamp to stay active
> all the time and not go into the nap mode?
>
> Thanks
>
> --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> > Hi again Andy,
> >
> > Yes, that straight out scan is going to be simpler than the mind
> set
> > for the POLLing commands. And yes, 0.5 second is forever in
> > microcomputer terms. On the Stamp, each one of those
instructions
> > like
> > > > IF (ButtonA = 1) THEN BtnA_Sub
> > will take about 1 millisecond to execute, so the entire loop to
> scan
> > 4 pushbuttons will execute in well under 10 milliseconds.
> >
> > Note that you also have to allow for the case that someone leans
on
> > one of the buttons. If you don't want the button action to occur
> over
> > and over, you will have to write code to do the action once per
> > event. Take a look at the BUTTON command, which has such
> debounce.
> > However, everyone agrees that with several buttons involved it is
> > more efficient & flexible to write your own code to do that.
> >
> > The simple scanning will be more of a problem if the Stamp has to
> do
> > a lot of other processing at the same time, or if you want it to
> > catch a quick 0.05 second button press or a similar signal that
> comes
> > from an instrument like a tipping bucket rain gage. Or, if the
> > program has to conserve power while waiting for a button to be
> > pressed. The POLLIN latched modes work really well with the
> POLLWAIT
> > command on the BS2pe/pe, so the chip can nap until an event
happens
> > and then test the scratchpad registers to determine which event
(s).
> >
> > You mentioned an RC input network. That can effectively stretch
> > events like the 30 millisecond rain gage pulse. Just a 0.1uf
> > capacitor from the Stamp input to ground, and 270 ohm resistors
to
> > limit the current to the stamp pin and to the switch. The stamp
> pin
> > is an output to charge the capacitor. The program returns about
> once
> > a second to check the voltage on the pin and to refresh it. If
it
> > finds zero volts, that means the switch has closed in the
interim.
> > The Stamp adds one to the count before refreshing the charge on
the
> > capacitor.
> >
> > -- Tracy
> >
> >
> >
> >
> >
> > >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
> > >>
> >