Shop OBEX P1 Docs P2 Docs Learn Events
Relay sequencer help — Parallax Forums

Relay sequencer help

ArchiverArchiver Posts: 46,084
edited 2002-04-27 05:23 in General Discussion
Hi again, guys,

here is a simple code that stamper Mr. Leroy wrote a few weeks ago for me and
I modified to meet my requirements. It has one little bug in it and I can't
seem to figure out how to mod this.


1. the code below just sequences a relay closure every time a push button is
pressed connected to (in0), P0, held high with a 10k resistor and switch closed
to ground. It moves one step from relay one to twelve and then back again to
one again every time the switch is pressed.
2. The outputs are from P1 to P12 respectively.

Now, here is the problem,
when the switch is held closed, the relays close in sequence one after the
other. What I want is the code to be modified to NOT move the relay that is
closed UNTIL the pushbutton is released and then in0 sees a ground state again.

here is the code:
outno var byte

loop:

for outno = 1 to 12

inputwait:

high 0

if in0 =1 then inputwait

pause 500

low outno -1

if outno=1 then help

help:

low 12

goto helper

helper:

high outno

next

GOTO loop





Any assistance is always appreciated

thanks to all

sincerely,

mike m





[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-04-27 03:30
    At 21:32 04/26/02, mocenter wrote:
    >Hi again, guys,
    >
    >here is a simple code that stamper Mr. Leroy wrote a few weeks ago for me
    >and I modified to meet my requirements. It has one little bug in it and I
    >can't seem to figure out how to mod this.
    >
    >1. the code below just sequences a relay closure every time a push button
    >is pressed connected to (in0), P0, held high with a 10k resistor and
    >switch closed to ground. It moves one step from relay one to twelve and
    >then back again to one again every time the switch is pressed.
    >2. The outputs are from P1 to P12 respectively.
    >
    >Now, here is the problem,when the switch is held closed, the relays close
    >in sequence one after the other. What I want is the code to be modified
    >to NOT move the relay that is closed UNTIL the pushbutton is released and
    >then in0 sees a ground state again.
    >
    >here is the code:
    >outno var byte
    >
    >loop:
    >for outno = 1 to 12
    >inputwait:
    > high 0
    > if in0 =1 then inputwait
    > pause 500
    > ' low outno -1
    > if outno=1 then help

    ' I think you need to test which pin (relay) is to be activated
    ' before activating or else when outno = 1 you activate your
    ' input pin before detecting you're on pin (relay) 1 and that
    ' it is 12, not 0 that needs to be turned off. Soooo....
    ' add the line below and comment out it's twin above.

    low outno -1

    >help:
    > low 12
    > ' goto helper

    ' You can comment out the line above since the code will go
    ' to "helper:" without it. you can also delete the label "helper:"
    ' below.

    >helper:
    > high outno

    I think adding the following two lines will do what you want. After the
    relay is activated above, these two lines should loop until the button is
    released.

    looper:
    if In0 = 0 then looper

    >next
    >GOTO loop

    No guarantees, but I think this is what you want, or at least close to it.


    Jim H
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-27 04:11
    Is this what you are looking for?


    leroy

    mocenter wrote:
    >
    > Hi again, guys,
    >
    > here is a simple code that stamper Mr. Leroy wrote a few weeks ago for me
    and I modified to meet my requirements. It has one little bug in it and I can't
    seem to figure out how to mod this.
    >
    > 1. the code below just sequences a relay closure every time a push button is
    pressed connected to (in0), P0, held high with a 10k resistor and switch closed
    to ground. It moves one step from relay one to twelve and then back again to
    one again every time the switch is pressed.
    > 2. The outputs are from P1 to P12 respectively.
    >
    > Now, here is the problem,
    > when the switch is held closed, the relays close in sequence one after the
    other. What I want is the code to be modified to NOT move the relay that is
    closed UNTIL the pushbutton is released and then in0 sees a ground state again.
    >
    > here is the code:


    outno var byte

    loop:

    for outno = 1 to 12

    inputwait:

    if in0 = 1 then inputwait

    inputwait2:

    if in0 = 0 then inputwait2

    high outno

    next

    GOTO loop
  • ArchiverArchiver Posts: 46,084
    edited 2002-04-27 05:22
    Dear Jim,
    Thanks for the help. Stayed up after midnight to try your changes and it
    works perfect. I appreciate yours and all the e-group guys help when we are
    in need
    sincerely,
    mike m
    Original Message
    From: Jim Higgins <HigginsJ@s...>
    To: <basicstamps@yahoogroups.com>
    Sent: Friday, April 26, 2002 10:30 PM
    Subject: Re: [noparse][[/noparse]basicstamps] RELAY SEQUENCER HELP


    > At 21:32 04/26/02, mocenter wrote:
    > >Hi again, guys,
    > >
    > >here is a simple code that stamper Mr. Leroy wrote a few weeks ago for me
    > >and I modified to meet my requirements. It has one little bug in it and
    I
    > >can't seem to figure out how to mod this.
    > >
    > >1. the code below just sequences a relay closure every time a push
    button
    > >is pressed connected to (in0), P0, held high with a 10k resistor and
    > >switch closed to ground. It moves one step from relay one to twelve and
    > >then back again to one again every time the switch is pressed.
    > >2. The outputs are from P1 to P12 respectively.
    > >
    > >Now, here is the problem,when the switch is held closed, the relays close
    > >in sequence one after the other. What I want is the code to be modified
    > >to NOT move the relay that is closed UNTIL the pushbutton is released
    and
    > >then in0 sees a ground state again.
    > >
    > >here is the code:
    > >outno var byte
    > >
    > >loop:
    > >for outno = 1 to 12
    > >inputwait:
    > > high 0
    > > if in0 =1 then inputwait
    > > pause 500
    > > ' low outno -1
    > > if outno=1 then help
    >
    > ' I think you need to test which pin (relay) is to be activated
    > ' before activating or else when outno = 1 you activate your
    > ' input pin before detecting you're on pin (relay) 1 and that
    > ' it is 12, not 0 that needs to be turned off. Soooo....
    > ' add the line below and comment out it's twin above.
    >
    > low outno -1
    >
    > >help:
    > > low 12
    > > ' goto helper
    >
    > ' You can comment out the line above since the code will go
    > ' to "helper:" without it. you can also delete the label "helper:"
    > ' below.
    >
    > >helper:
    > > high outno
    >
    > I think adding the following two lines will do what you want. After the
    > relay is activated above, these two lines should loop until the button is
    > released.
    >
    > looper:
    > if In0 = 0 then looper
    >
    > >next
    > >GOTO loop
    >
    > No guarantees, but I think this is what you want, or at least close to it.
    >
    >
    > Jim H
    >
    >
    > 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 2002-04-27 05:23
    Dear Leroy,
    thanks for your help. Jim Higgins code worked perfect
    sincerely,
    Mike m
    Original Message
    From: Leroy Hall <leroy@f...>
    To: <basicstamps@yahoogroups.com>
    Sent: Friday, April 26, 2002 11:11 PM
    Subject: Re: [noparse][[/noparse]basicstamps] RELAY SEQUENCER HELP


    > Is this what you are looking for?
    >
    >
    > leroy
    >
    > mocenter wrote:
    > >
    > > Hi again, guys,
    > >
    > > here is a simple code that stamper Mr. Leroy wrote a few weeks ago for
    me and I modified to meet my requirements. It has one little bug in it and
    I can't seem to figure out how to mod this.
    > >
    > > 1. the code below just sequences a relay closure every time a push
    button is pressed connected to (in0), P0, held high with a 10k resistor and
    switch closed to ground. It moves one step from relay one to twelve and
    then back again to one again every time the switch is pressed.
    > > 2. The outputs are from P1 to P12 respectively.
    > >
    > > Now, here is the problem,
    > > when the switch is held closed, the relays close in sequence one after
    the other. What I want is the code to be modified to NOT move the relay
    that is closed UNTIL the pushbutton is released and then in0 sees a ground
    state again.
    > >
    > > here is the code:
    >
    >
    > outno var byte
    >
    > loop:
    >
    > for outno = 1 to 12
    >
    > inputwait:
    >
    > if in0 = 1 then inputwait
    >
    > inputwait2:
    >
    > if in0 = 0 then inputwait2
    >
    > high outno
    >
    > next
    >
    > GOTO loop
    >
    >
    > 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.