Shop OBEX P1 Docs P2 Docs Learn Events
Detecting positive edge — Parallax Forums

Detecting positive edge

ArchiverArchiver Posts: 46,084
edited 2000-09-14 14:57 in General Discussion
Your Stamp probably isn't the right tool to reach for when trying to
reliably detect edges/short pulses, or generate a continuous pulse
train. I built myself a Stamp accessory for these purposes. See
the Pulse Machine info at:

http://home.earthlink.net/~parkiss/

In particular, I believe the "latch pulse" and "clock generator"
commands, under Stamp control, will do what you're after. Here's a
simple example using the latch pulse command and two Stamp pins:

SEROUT pulsex_pin,out_baud,[noparse][[/noparse]$0c] 'latch pulse input
await:
IF pulseout_pin = 1 THEN await 'check "latched" status

Here's an example of generating a 4 usec period clock (2 usec low, 2
usec high) off the PM-1 pulseout pin:

SEROUT pulsex_pin,out_baud,[noparse][[/noparse]$06,0,0,0,2,0,0,0,2]

You can define the clock generator's duty cycle and clock period as
desired.

The PM-1 has several other pulse functions and a simple LCD
interface as well. You can build your own from the provided source
code or contact me off-list if you'd like to purchase a programmed
chip.

Steve

On 14 Sep 00 at 13:45, pwang@d... wrote:

> HI, everone,
> Can I use BS2 to detect positive going edge of a pulse
> input to BS2, or do I need to use external TTL cricuit
> to do that?
> Currently, I need to detect pulse edge of every pulse
> coming itno BS2.
>
> * Is it OK, if I just detect the pulse at 5V level?
>
> topline:
> if IN1 then isSTART
> goto topline
>
> isSTART:
> 5V level detected.
>
> but BS2 takes some time to execute the topline: loop, I
> might miss a pulse.
>
> Thanks,
> wang

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-09-14 14:45
    HI, everone,
    Can I use BS2 to detect positive going edge of a pulse
    input to BS2, or do I need to use external TTL cricuit
    to do that?
    Currently, I need to detect pulse edge of every pulse
    coming itno BS2.

    * Is it OK, if I just detect the pulse at 5V level?

    topline:
    if IN1 then isSTART
    goto topline

    isSTART:
    5V level detected.

    but BS2 takes some time to execute the topline: loop, I
    might miss a pulse.

    Thanks,
    wang
  • ArchiverArchiver Posts: 46,084
    edited 2000-09-14 14:57
    In a message dated 9/14/00 8:47:25 AM Central Daylight Time,
    pwang@d... writes:

    > topline:
    > if IN1 then isSTART
    > goto topline
    >
    > isSTART:
    > 5V level detected.
    >
    > but BS2 takes some time to execute the topline: loop, I
    > might miss a pulse.

    You can use PULSIN to detect fast pulses -- so long as there isn't more thatn
    131 ms between them.
Sign In or Register to comment.