Shop OBEX P1 Docs P2 Docs Learn Events
edge detection OOPS! — Parallax Forums

edge detection OOPS!

ArchiverArchiver Posts: 46,084
edited 2000-12-02 17:25 in General Discussion
OOPS There are an error in the previous:
the correct is:

loop:
if inx = 1 then loop: (only wiil goto next line if state is low)
loop2:
if inx = 1 then your routine
goto loop2:

sorry
ACjacques


A.C.Jacques wrote:
>
> The statment if INx= 1 looks only for a high state no the transition
> itself but if your square wave have a lower frequency than the loop then
> it will go to routine very close with the rising edge. But there are no
> garantee that the first entrance in the loop the statement will be close
> to the edge. To do this you may look for two transitions:
>
> loop:
> if inx = 1 then loop: (only wiil goto next line if state is low)
> if inx = 1 then your routine
> goto loop:
>
> ACJacques
>
> djarmis@p... wrote:
> >
> > The signal I'm detecting the edge on is a repetitive square wave. It's
> > possible that at the time the if INx=1 statement occurs the level
> > could be high. Would this satisfy the if statement or does INx only
> > look for a transition from a 0 to a 1? I'm new to Stamps and no little
> > about the language so I may be asking a dump question. Thanks,
> >
> > --- In basicstamps@egroups.com, "A.C.Jacques" <acjacques@i...> wrote:
> > > Then this is very simple:
> > > loop:
> > > if INx = 1 then goto yourroutine (use = 0 if want to detect falling
> > > edge) (x is your pin number)
> > > goto loop
> > >
> > > ACJacques
> > >
> > > djarmis@p... wrote:
> > > >
> > > > While it's looking for the edge it won't be doing anything else.
> > The
> > > > program will just wait for the edge to occur. When it detects it I
> > > > will need to go to a routine that will read some serial bytes in.
> > I
> > > > looked at the button command but not sure what it does. Thanks,
> > > >
> > > > --- In basicstamps@egroups.com, LarryGaminde <lgaminde@t...>
> > wrote:
> > > > > Is this all the chip needs to do, or will it be reading or doing
> > > > other
> > > > > things while looking for a rising or falling edge.
> > > > >
> > > > > djarmis@p... wrote:
> > > > > >
> > > > > > I need to monitor an input and detect a rising or falling
> > edge.
> > > > Upon
> > > > > > detection run a serial input routine. The pulse is one input
> > and
> > > > the
> > > > > > serial stream is another.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-12-02 17:25
    The signal is a odd/even field index for a standard NTSC video signal.
    So, Each rising edge is ~60ms apart. I believe your method should work
    fine. Thanks,

    --- In basicstamps@egroups.com, "A.C.Jacques" <acjacques@i...> wrote:
    > OOPS There are an error in the previous:
    > the correct is:
    >
    > loop:
    > if inx = 1 then loop: (only wiil goto next line if state is low)
    > loop2:
    > if inx = 1 then your routine
    > goto loop2:
    >
    > sorry
    > ACjacques
    >
    >
    > A.C.Jacques wrote:
    > >
    > > The statment if INx= 1 looks only for a high state no the
    transition
    > > itself but if your square wave have a lower frequency than the
    loop then
    > > it will go to routine very close with the rising edge. But there
    are no
    > > garantee that the first entrance in the loop the statement will be
    close
    > > to the edge. To do this you may look for two transitions:
    > >
    > > loop:
    > > if inx = 1 then loop: (only wiil goto next line if state is low)
    > > if inx = 1 then your routine
    > > goto loop:
    > >
    > > ACJacques
    > >
    > > djarmis@p... wrote:
    > > >
    > > > The signal I'm detecting the edge on is a repetitive square
    wave. It's
    > > > possible that at the time the if INx=1 statement occurs the
    level
    > > > could be high. Would this satisfy the if statement or does INx
    only
    > > > look for a transition from a 0 to a 1? I'm new to Stamps and no
    little
    > > > about the language so I may be asking a dump question. Thanks,
    > > >
    > > > --- In basicstamps@egroups.com, "A.C.Jacques" <acjacques@i...>
    wrote:
    > > > > Then this is very simple:
    > > > > loop:
    > > > > if INx = 1 then goto yourroutine (use = 0 if want to detect
    falling
    > > > > edge) (x is your pin number)
    > > > > goto loop
    > > > >
    > > > > ACJacques
    > > > >
    > > > > djarmis@p... wrote:
    > > > > >
    > > > > > While it's looking for the edge it won't be doing anything
    else.
    > > > The
    > > > > > program will just wait for the edge to occur. When it
    detects it I
    > > > > > will need to go to a routine that will read some serial
    bytes in.
    > > > I
    > > > > > looked at the button command but not sure what it does.
    Thanks,
    > > > > >
    > > > > > --- In basicstamps@egroups.com, LarryGaminde <lgaminde@t...>
    > > > wrote:
    > > > > > > Is this all the chip needs to do, or will it be reading or
    doing
    > > > > > other
    > > > > > > things while looking for a rising or falling edge.
    > > > > > >
    > > > > > > djarmis@p... wrote:
    > > > > > > >
    > > > > > > > I need to monitor an input and detect a rising or
    falling
    > > > edge.
    > > > > > Upon
    > > > > > > > detection run a serial input routine. The pulse is one
    input
    > > > and
    > > > > > the
    > > > > > > > serial stream is another.
Sign In or Register to comment.