Shop OBEX P1 Docs P2 Docs Learn Events
doh! — Parallax Forums

doh!

ArchiverArchiver Posts: 46,084
edited 2003-05-19 03:15 in General Discussion
Many thanks to both Steve and Eric for answering my stupid newbie
question. I've been playing around with electronics for a while but
am somewhat new to microcontrollers in general and stamps in
particular. I didn't check the manual too carefully because, to me,
the behavior seemed so odd that I didn't think it could possibly be
meant to do that by design. I suppose the moral is to put the I/O
pins in input mode before issuing an end or sleep command.

--- In basicstamps@yahoogroups.com, "S Parkis" <parkiss@e...> wrote:
> I'm not sure what you mean by toggling, but it may be you're
seeing
> the results of the END statement being the last statement
executed.
> See END and SLEEP in the manual and pay particular attention to
the
> comments regarding low power mode and the ~2.3 second watchdog
timer.
>
> Try this instead and see if it fixes things:
>
> '{$STAMP BS2}
> dirs = %000000000001111
> out0=0
> out1 =0
> out2=0
> out3=1
> stop
>
> Regards,
>
> Steve
>
> On 18 May 03 at 7:18, max2451234 wrote:
>
> > I seem to have encountered a strange problem with my BS2
(original)
> > and I'm hoping someone out there has a solution. Any time any of
> > the 16 I/O pins is placed in output mode, the pin will strangely
> > toggle its state every 2 seconds for no apparent reason...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-05-18 20:15
    On 18 May 03 at 18:55, max2451234 wrote:

    > ...I suppose the moral is to put the I/O pins in input mode before
    > issuing an end or sleep command.

    FWIW, the more common approach when using END or SLEEP is to leave
    the pins as outputs and use pullup/pulldown resistors to ensure the
    desired high/low level is present during the watchdog's brief
    interruptions of a driven state.

    Regards,

    Steve
  • ArchiverArchiver Posts: 46,084
    edited 2003-05-19 03:15
    >On 18 May 03 at 18:55, max2451234 wrote:
    >
    > > ...I suppose the moral is to put the I/O pins in input mode before
    > > issuing an end or sleep command.
    >
    >FWIW, the more common approach when using END or SLEEP is to leave
    >the pins as outputs and use pullup/pulldown resistors to ensure the
    >desired high/low level is present during the watchdog's brief
    >interruptions of a driven state.
    >
    >Regards,
    >
    >Steve

    It's usually not a good idea to leave unconnected pins as inputs.
    Although it will not hurt anything, the Stamp will draw a little bit
    of excess power supply current.

    As Steve points out, sometimes you will need to have an output remain
    in a particular output state, high or low, even when the Stamp is in
    a Sleep state and when it makes that brief hiccup once every two
    seconds. The pullup or pulldown resistor can assure that it stays in
    one state. For output devices that do not draw a lot of current, it
    is also possible to use a small capacitor to hold the level during
    the brief glitch.

    On most of the Stamps, every output turns briefly to an input (16-18
    milliseconds) when the Stamp wakes up (in END, SLEEP or NAP or
    POLLWAIT). However, the new BS2pe is special, because the brief
    glitch is reduced to about 150 microseconds, 0.15 millisecond.
    Because of that, the glitch is much easier to filter and the BS2pe
    can get a lot of useful work done in the time that it would take for
    all of the other Stamps just to wake up from SLEEP.

    -- regards,
    Tracy Allen .
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
Sign In or Register to comment.