Shop OBEX P1 Docs P2 Docs Learn Events
Input Timing.... — Parallax Forums

Input Timing....

ArchiverArchiver Posts: 46,084
edited 2000-06-24 23:14 in General Discussion
Tim-

The Stamp innards are optimized to look at specific groups of
I/O pins (e.g. P0-P3, P0-P7, P0-P15) very efficiently with the
INA, INL, INS, etc. predefined variables. Read up on them (and
their OUTx brethren) for a description. For example, a tight loop
such as

waitForHigh:
IF INA = 0 THEN waitForHigh

will detect any of I/O's 0 thru 3 going high, but will also hold your
Stamp's program at this point until one or more does go high. In
this example, the inputs are checked approximately four times each
millisecond, which may allow more than one input to go high between
samples. If you need a shorter sampling interval to achieve greater
which-went-first resolution, you'll need some external logic.

Steve


On 24 Jun 00 at 15:14, Tim and Jo wrote:

> ...I have several logic inputs to a Stamp II and I'd like to be
> able to tell which input goes high or low first. The problem seems
> to me that if the program is run sequentialy, how are all of the
> inputs checked at the same time?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-06-24 19:29
    IF all inputs are pulled high a better way

    main:

    If INA <INB then x......

    If INB <INA then y....

    goto main

    Original Message
    From: "S Parkis" <parkiss@e...>
    To: <basicstamps@egroups.com>
    Sent: Saturday, June 24, 2000 9:11 AM
    Subject: Re: [noparse][[/noparse]basicstamps] Input Timing....


    > Tim-
    >
    > The Stamp innards are optimized to look at specific groups of
    > I/O pins (e.g. P0-P3, P0-P7, P0-P15) very efficiently with the
    > INA, INL, INS, etc. predefined variables. Read up on them (and
    > their OUTx brethren) for a description. For example, a tight loop
    > such as
    >
    > waitForHigh:
    > IF INA = 0 THEN waitForHigh
    >
    > will detect any of I/O's 0 thru 3 going high, but will also hold
    your
    > Stamp's program at this point until one or more does go high. In
    > this example, the inputs are checked approximately four times each
    > millisecond, which may allow more than one input to go high between
    > samples. If you need a shorter sampling interval to achieve greater
    > which-went-first resolution, you'll need some external logic.
    >
    > Steve
    >
    >
    > On 24 Jun 00 at 15:14, Tim and Jo wrote:
    >
    > > ...I have several logic inputs to a Stamp II and I'd like to be
    > > able to tell which input goes high or low first. The problem
    seems
    > > to me that if the program is run sequentialy, how are all of the
    > > inputs checked at the same time?
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-24 23:14
    Hello Everyone,

    I know that many of you must have worked through this problem before and
    I'm hoping that you can help out. I have several logic inputs to a Stamp II
    and I'd like to be able to tell which input goes high or low first. The
    problem seems to me that if the program is run sequentialy, how are all of
    the inputs checked at the same time? I know that a Stamp II is fast, but
    it's still running the program one line at a time. Is there a simple
    solution to this? Can an input buffer simular to the Mem Key module sort
    this out, store the input timing information and then report back to a
    Stamp, or am I missing something basic and making this more difficult than
    it needs to be? Any help with your experiences would be much appreciated.

    Tim
Sign In or Register to comment.