Shop OBEX P1 Docs P2 Docs Learn Events
Toggle input — Parallax Forums

Toggle input

ArchiverArchiver Posts: 46,084
edited 2001-11-02 16:41 in General Discussion
Ray-

Assuming this truth table:

last this desired
time time result

0 0 0
0 1 1
1 0 0
1 1 0


And that you're working with a BS1:

SYMBOL this = BIT0
SYMBOL last = BIT1
SYMBOL result = BIT2

last = 1
again:
this = PIN1
result = ~last & this
DEBUG CR,BIN1 last, BIN1 this, BIN1 result
last = this
GOTO again

Regards,

Steve

On 31 Oct 01 at 20:16, Ray Gonzalez wrote:

> Hi Guys I need help, I have an application that need to process and
> input just one time even if the input stay on for more than one scan...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-11-01 01:16
    Hi Guys I need help, I have an application that need to process and input just
    one time even if the input stay on for more than one scan I remember seeing a
    little code that did just that something like

    b1=b0
    b0=pin1
    b2=b1^ pin1

    this one give me a b2=1 on the 2 edges of pin1 I like to have b2=1 only on the
    rising edge of pin1

    Thank you
    Ray


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-01 06:37
    >Hi Guys I need help, I have an application that need to process and
    >input just one time even if the input stay on for more than one scan
    >I remember seeing a little code that did just that something like
    >
    >b1=b0
    >b0=pin1
    >b2=b1^ pin1
    >
    >this one give me a b2=1 on the 2 edges of pin1 I like to have b2=1
    >only on the rising edge of pin1

    Maybe...
    x1=x0
    x0=pin1
    x2=x1^ x0 & x0 ' <<<< add the & x0 to single out the rising edge.

    I changed the variable to "x" to avoid confusion with the reserved
    BS2 names, "b0" to "b25". ("b0" to "b13" on the BS1).

    For your program you only need bit variables
    x0 var bit
    etc.

    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-02 03:21
    you could use a gosub routine on a state change, see if the pin has
    changed back, if not return.

    On Wed, 31 Oct 2001 20:16:36 -0500 "Ray Gonzalez" <reyg@v...>
    writes:
    > Hi Guys I need help, I have an application that need to process and
    > input just one time even if the input stay on for more than one scan
    > I remember seeing a little code that did just that something like
    >
    > b1=b0
    > b0=pin1
    > b2=b1^ pin1
    >
    > this one give me a b2=1 on the 2 edges of pin1 I like to have b2=1
    > only on the rising edge of pin1
    >
    > Thank you
    > Ray
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-02 03:47
    it looks like your using a bs1, have you tried to incorporate the button
    routine in your program it will do what you want if your program isnt to
    big

    On Thu, 1 Nov 2001 21:21:07 -0600 kelvin l schroeder <kls48@j...>
    writes:
    > you could use a gosub routine on a state change, see if the pin has
    > changed back, if not return.
    >
    > On Wed, 31 Oct 2001 20:16:36 -0500 "Ray Gonzalez"
    > <reyg@v...>
    > writes:
    > > Hi Guys I need help, I have an application that need to process
    > and
    > > input just one time even if the input stay on for more than one
    > scan
    > > I remember seeing a little code that did just that something like
    > >
    > > b1=b0
    > > b0=pin1
    > > b2=b1^ pin1
    > >
    > > this one give me a b2=1 on the 2 edges of pin1 I like to have b2=1
    >
    > > only on the rising edge of pin1
    > >
    > > Thank you
    > > Ray
    > >
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed. Text in the
    > > Subject and Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    > > http://docs.yahoo.com/info/terms/
    > >
    > >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-02 16:41
    thank you very much for the help guys
    Ray
    Original Message
    From: "Ray Gonzalez" <reyg@v...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, October 31, 2001 8:16 PM
    Subject: [noparse][[/noparse]basicstamps] TOGGLE INPUT


    > Hi Guys I need help, I have an application that need to process and input
    just one time even if the input stay on for more than one scan I remember
    seeing a little code that did just that something like
    >
    > b1=b0
    > b0=pin1
    > b2=b1^ pin1
    >
    > this one give me a b2=1 on the 2 edges of pin1 I like to have b2=1 only on
    the rising edge of pin1
    >
    > Thank you
    > Ray
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
Sign In or Register to comment.