Shop OBEX P1 Docs P2 Docs Learn Events
Potential timing problem — Parallax Forums

Potential timing problem

ArchiverArchiver Posts: 46,084
edited 2004-06-13 17:29 in General Discussion
Since Stamps don't use interrupts, what would be the results of the
following?
You are detecting the state of an input(high or low, doesn't matter)
using IF THEN or something similar, and the Stamp just happens to be
EXACTLY in the middle of a clock cycle when a transition occurs. Will
the Stamp call this a high or a low? Or will it become very confused
and stop working?

Dave

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-06-12 21:56
    I believe the BS2 makes logic decisions at
    the 1.4 volt point.

    Thus, if your voltage is changing as the BS2
    reads it, the BS2 will get a 'snapshot' of the
    state -- if it is above 1.4 volts, the BS2
    will say it is a 1. If below, it will say
    it is a 0.

    --- In basicstamps@yahoogroups.com, "dersonquilter2"
    <dersonquilter2@y...> wrote:
    > Since Stamps don't use interrupts, what would be the results of the
    > following?
    > You are detecting the state of an input(high or low, doesn't matter)
    > using IF THEN or something similar, and the Stamp just happens to
    be
    > EXACTLY in the middle of a clock cycle when a transition occurs.
    Will
    > the Stamp call this a high or a low? Or will it become very
    confused
    > and stop working?
    >
    > Dave
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-13 17:29
    --- In basicstamps@yahoogroups.com, "dersonquilter2"
    <dersonquilter2@y...> wrote:
    > Since Stamps don't use interrupts, what would be the results of the
    > following?
    > You are detecting the state of an input(high or low, doesn't matter)
    > using IF THEN or something similar, and the Stamp just happens to
    be
    > EXACTLY in the middle of a clock cycle when a transition occurs.
    Will
    > the Stamp call this a high or a low? Or will it become very
    confused
    > and stop working?
    >
    > Dave


    The difference here is between analogue and discrete signals.

    a discrete signal is just ON or OFF, there is no middle or in-between
    point.

    When the program reaches said input, it looks at that input and
    decides if it is high or low and then just keeps running with
    whatever it saw.

    The speed of a circuit is often a question, and if speed of response
    is an issure, you control should be a minimum of 4 times faster than
    the thing being controlled.

    Dave
Sign In or Register to comment.