Shop OBEX P1 Docs P2 Docs Learn Events
generating constant output of pulses from BS2 — Parallax Forums

generating constant output of pulses from BS2

ArchiverArchiver Posts: 46,084
edited 2004-03-02 22:56 in General Discussion
Another approach: a FOR-NEXT loop that never ends. I do this to
myself (unintentionally) more often than I'd like to admit. Just
make your end-value larger than your FOR variable can hold:

i VAR NIB

FOR i = 0 TO 20
(do whatever)
NEXT i

This FOR-NEXT never ends, because i never reaches 20 (it can only get
as large as 15). So:

FOR i = 0 TO 20
OUTA = %1100 >> (i // 4)
PAUSE INB * 100
NEXT

That will put the bit pattern out on pins 0-3 at a speed determined
by the value presented on pins 4-7.

Regards,

Steve







On 2 Mar 04 at 16:37, cnc002@a... wrote:

> Hello guys:
>
> Is there any way other than using PULSOUT and a continuous goto
> command to generated a constant output of pulses from the BS2.
>
> What I am wanting to do is create a quadrature encoder emulator
> using the Stamp. I can create the 90 degree phase shift for the A
> and B signals easily enough using a D type flip flop and would like
> to be able to control the frequency of the signals using inputs to
> the Stamp to select a fast speed and then a slow speed pulse plus
> one inverted pulse to simulate reverse direction of the encoder.
>
> I have played around with the BS2 but nothing really heavy and it
> seems that it would be a perfect replacement for all the CMOS
> discreet chips that are required to create the circuit I am
> describing. I have done this with 14xxx series CMOS chips already
> but would love to be able to simply modify certain parameters with
> software in the Stamp rather than having to change out wiring or
> other components to do it.
>
> Any suggestions or assistance will be greatly appreciated.
>
> Randy Abernathy
> 4626 Old Stilesboro Road NW
> Acworth, GA 30101-4066
> Phone / Fax: 770-974-5295
> Mobile: 678-772-4113
> E-mail: cnc002@a...
>
> I furnish technical support, repair, and other related services for
> your industrial woodworking machinery. My background as Senior
> Service Engineer for the SCMI Group for nearly fifteen years with
> factory training, combines with my extensive background in
> electronics, mechanics, pneumatics, electrical and CNC machinery to
> offer you needed support for your machinery.
>
>
> [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.
>
> Yahoo! Groups Links
>
>
>
>
>

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-03-02 21:37
    Hello guys:

    Is there any way other than using PULSOUT and a continuous goto command to
    generated a constant output of pulses from the BS2.

    What I am wanting to do is create a quadrature encoder emulator using the
    Stamp. I can create the 90 degree phase shift for the A and B signals easily
    enough using a D type flip flop and would like to be able to control the
    frequency of the signals using inputs to the Stamp to select a fast speed and
    then a
    slow speed pulse plus one inverted pulse to simulate reverse direction of the
    encoder.

    I have played around with the BS2 but nothing really heavy and it seems that
    it would be a perfect replacement for all the CMOS discreet chips that are
    required to create the circuit I am describing. I have done this with 14xxx
    series CMOS chips already but would love to be able to simply modify certain
    parameters with software in the Stamp rather than having to change out wiring or

    other components to do it.

    Any suggestions or assistance will be greatly appreciated.

    Randy Abernathy
    4626 Old Stilesboro Road NW
    Acworth, GA 30101-4066
    Phone / Fax: 770-974-5295
    Mobile: 678-772-4113
    E-mail: cnc002@a...

    I furnish technical support, repair, and other related services for your
    industrial woodworking machinery. My background as Senior Service Engineer for
    the
    SCMI Group for nearly fifteen years with factory training, combines with my
    extensive background in electronics, mechanics, pneumatics, electrical and CNC
    machinery to offer you needed support for your machinery.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-03-02 22:15
    This is possible, but what you must take into consideration is that simply
    controlling your A and B pins in a top down programming approach and then
    jumping back up to the top will introduce a delay or 'glitch' resulting
    in a quadrature pattern that isn't symmetrical.

    i.e. this is what you don't want....

    START:

    LOW A
    LOW B

    HIGH A
    LOW B

    HIGH A
    HIGH B

    LOW A
    HIGH B

    goto START


    What might be a better solution is to have a lookup table something like...


    MainLoop:
    LOOKUP index,[noparse][[/noparse]00,10,11,01],Pins

    OUT Pins

    {delay loop here}

    if direction = 1 then
    index = index + 1
    else
    index = index - 1
    end if

    goto MainLoop

    ...The idea here is that each level of qadrature transition 'sees' the
    same amount of delay.


    -Beau Schwabe


    >Hello guys:
    >
    >Is there any way other than using PULSOUT and a continuous goto command to
    >generated a constant output of pulses from the BS2.
    >
    >What I am wanting to do is create a quadrature encoder emulator using the
    >Stamp. I can create the 90 degree phase shift for the A and B signals easily
    >enough using a D type flip flop and would like to be able to control the
    >frequency of the signals using inputs to the Stamp to select a fast speed
    >and then a
    >slow speed pulse plus one inverted pulse to simulate reverse direction of the
    >encoder.
    >
    >I have played around with the BS2 but nothing really heavy and it seems that
    >it would be a perfect replacement for all the CMOS discreet chips that are
    >required to create the circuit I am describing. I have done this with 14xxx
    >series CMOS chips already but would love to be able to simply modify certain
    >parameters with software in the Stamp rather than having to change out
    >wiring or
    >other components to do it.
    >
    >Any suggestions or assistance will be greatly appreciated.
    >
    >Randy Abernathy
    >4626 Old Stilesboro Road NW
    >Acworth, GA 30101-4066
    >Phone / Fax: 770-974-5295
    >Mobile: 678-772-4113
    >E-mail: cnc002@a...
    >
    >I furnish technical support, repair, and other related services for your
    >industrial woodworking machinery. My background as Senior Service Engineer
    >for the
    >SCMI Group for nearly fifteen years with factory training, combines with my
    >extensive background in electronics, mechanics, pneumatics, electrical and
    >CNC
    >machinery to offer you needed support for your machinery.
  • ArchiverArchiver Posts: 46,084
    edited 2004-03-02 22:39
    In a message dated 3/2/2004 5:38:58 PM Eastern Standard Time,
    bschwabe@a... writes:
    This is possible, but what you must take into consideration is that simply
    controlling your A and B pins in a top down programming approach and then
    jumping back up to the top will introduce a delay or 'glitch' resulting
    in a quadrature pattern that isn't symmetrical.

    i.e. this is what you don't want....

    START:

    LOW A
    LOW B

    HIGH A
    LOW B

    HIGH A
    HIGH B

    LOW A
    HIGH B

    goto START


    What might be a better solution is to have a lookup table something like...


    MainLoop:
    LOOKUP index,[noparse][[/noparse]00,10,11,01],Pins

    OUT Pins

    {delay loop here}

    if direction = 1 then
    index = index + 1
    else
    index = index - 1
    end if

    goto MainLoop

    ...The idea here is that each level of qadrature transition 'sees' the
    same amount of delay.


    -Beau Schwabe
    Beau:

    Yep, that is exactly why I am looking for another way to do it.



    Randy Abernathy
    4626 Old Stilesboro Road NW
    Acworth, GA 30101-4066
    Phone / Fax: 770-974-5295
    Mobile: 678-772-4113
    E-mail: cnc002@a...

    I furnish technical support, repair, and other related services for your
    industrial woodworking machinery. My background as Senior Service Engineer for
    the
    SCMI Group for nearly fifteen years with factory training, combines with my
    extensive background in electronics, mechanics, pneumatics, electrical and CNC
    machinery to offer you needed support for your machinery.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-03-02 22:56
    Since the BS2 is a single-tasking beast,
    you'll have to use a continuous 'goto' command
    to generate continuous pulses.

    Beau's Lookup approach is quite ingenious,
    actually, since he found a way to make every
    cycle around the loop the same number of instructions,
    regardless of the output data.

    You'll have to experiment with 'PAUSE' values to
    get the timing you are looking for.


    --- In basicstamps@yahoogroups.com, cnc002@a... wrote:
    > Hello guys:
    >
    > Is there any way other than using PULSOUT and a continuous goto
    command to
    > generated a constant output of pulses from the BS2.
    >
    > What I am wanting to do is create a quadrature encoder emulator
    using the
    > Stamp. I can create the 90 degree phase shift for the A and B
    signals easily
    > enough using a D type flip flop and would like to be able to
    control the
    > frequency of the signals using inputs to the Stamp to select a fast
    speed and then a
    > slow speed pulse plus one inverted pulse to simulate reverse
    direction of the
    > encoder.
    >
    > I have played around with the BS2 but nothing really heavy and it
    seems that
    > it would be a perfect replacement for all the CMOS discreet chips
    that are
    > required to create the circuit I am describing. I have done this
    with 14xxx
    > series CMOS chips already but would love to be able to simply
    modify certain
    > parameters with software in the Stamp rather than having to change
    out wiring or
    > other components to do it.
    >
    > Any suggestions or assistance will be greatly appreciated.
    >
    > Randy Abernathy
    > 4626 Old Stilesboro Road NW
    > Acworth, GA 30101-4066
    > Phone / Fax: 770-974-5295
    > Mobile: 678-772-4113
    > E-mail: cnc002@a...
    >
    > I furnish technical support, repair, and other related services for
    your
    > industrial woodworking machinery. My background as Senior Service
    Engineer for the
    > SCMI Group for nearly fifteen years with factory training, combines
    with my
    > extensive background in electronics, mechanics, pneumatics,
    electrical and CNC
    > machinery to offer you needed support for your machinery.
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.