Shop OBEX P1 Docs P2 Docs Learn Events
BS2 phase shift, signal delay — Parallax Forums

BS2 phase shift, signal delay

ArchiverArchiver Posts: 46,084
edited 2001-08-31 19:58 in General Discussion
From an external source I have a 12 volt square wave signal (20% duty
cycle at 200Hz).

I would like to input this singal ino a BS2 and ouput the same signal
with a 200 microsecond delay. (Approx. 15% phase shift).

Any suggestions or comments would be appreciated.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-08-31 17:07
    > >From an external source I have a 12 volt square wave signal (20% duty
    >cycle at 200Hz).
    >
    >I would like to input this singal ino a BS2 and ouput the same signal
    >with a 200 microsecond delay. (Approx. 15% phase shift).
    >
    >Any suggestions or comments would be appreciated.

    Why use a BASIC Stamp? Would a simple delay circuit using a couple
    of 555 timers or RC delays work okay? If you need exact control over
    the delay, and if the output signal has to be an exact copy of the
    input signal, then you will need a much faster micro. The Stamp is
    not so good for that, because each single Stamp instruction takes
    about 200 microseconds.

    That said, you could get near a 200 microsecond delay by having the
    stamp delay one instruction:

    x var word
    loop:
    RCtime 0,0,x ' wait for P0 to go high
    ' will delay about 220 microseconds here
    pulsout 1,500 ' output a 1 millisecond pulse on P1
    RCtime 0,1,x ' wait for P0 to go low
    goto loop

    The RCtime instructions above are only used to await a change in pin
    state. One millisecond is 20% duty cycle of a 200hz signal.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-31 17:23
    I had the same thought -- just use an RC. However, I wonder how much delay
    you'd get with this:

    OUTPUT 1
    loop:
    out1=in0
    goto loop

    There would be some delay but I don't know how much or how repeatable.

    Al Williams
    AWC
    * Floating point A/D
    http://www.al-williams.com/awce/pak9.htm

    >
    Original Message
    > From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=cl3JeeUWtTEBmRFx7GyDhuiv3YrzMbhCZy-jVfP9r6bSftQn-OUz1AQjxNwV_xkFDwcYUsJ7qB3it3om]tracy@e...[/url
    > Sent: Friday, August 31, 2001 11:07 AM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] BS2 phase shift, signal delay
    >
    >
    > > >From an external source I have a 12 volt square wave signal (20% duty
    > >cycle at 200Hz).
    > >
    > >I would like to input this singal ino a BS2 and ouput the same signal
    > >with a 200 microsecond delay. (Approx. 15% phase shift).
    > >
    > >Any suggestions or comments would be appreciated.
    >
    > Why use a BASIC Stamp? Would a simple delay circuit using a couple
    > of 555 timers or RC delays work okay? If you need exact control over
    > the delay, and if the output signal has to be an exact copy of the
    > input signal, then you will need a much faster micro. The Stamp is
    > not so good for that, because each single Stamp instruction takes
    > about 200 microseconds.
    >
    > That said, you could get near a 200 microsecond delay by having the
    > stamp delay one instruction:
    >
    > x var word
    > loop:
    > RCtime 0,0,x ' wait for P0 to go high
    > ' will delay about 220 microseconds here
    > pulsout 1,500 ' output a 1 millisecond pulse on P1
    > RCtime 0,1,x ' wait for P0 to go low
    > goto loop
    >
    > The RCtime instructions above are only used to await a change in pin
    > state. One millisecond is 20% duty cycle of a 200hz signal.
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
    >
    >
    > 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-08-31 17:59
    Are you trying to make two separate readings with a 200 µSec delay and then
    act on the logical result? Still sounds like a dual oneshot and a couple of
    AND gates would work better and cheaper.
    Mike


    At 03:31 PM 8/31/2001 +0000, you wrote:
    > >From an external source I have a 12 volt square wave signal (20% duty
    >cycle at 200Hz).
    >
    >I would like to input this singal ino a BS2 and ouput the same signal
    >with a 200 microsecond delay. (Approx. 15% phase shift).
    >
    >Any suggestions or comments would be appreciated.
    >
    >
    >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/

    _________________________________
    Mike Walsh
    walsh@i...
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-31 18:02
    This is a very difficult task. May I ask why you would want to do such
    a thing?

    Leroy

    dynamictech@v... wrote:
    >
    > >From an external source I have a 12 volt square wave signal (20% duty
    > cycle at 200Hz).
    >
    > I would like to input this singal ino a BS2 and ouput the same signal
    > with a 200 microsecond delay. (Approx. 15% phase shift).
    >
    > Any suggestions or comments would be appreciated.
    >
    > 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-08-31 19:58
    >I had the same thought -- just use an RC. However, I wonder how much delay
    >you'd get with this:
    >
    >OUTPUT 1
    >loop:
    > out1=in0
    > goto loop
    >
    >There would be some delay but I don't know how much or how repeatable.
    >
    >Al Williams
    >AWC
    >* Floating point A/D
    >http://www.al-williams.com/awce/pak9.htm

    From data at
    http://www.emesystems.com/BS2speed.htm#timetables
    out1 or in0 would each require about 140 microseconds, and the "goto
    loop" would take about 250 microseconds. So, depending where pulse
    occurred in relation to the execution of the loop, the delay could
    vary from 140 to 530 microseconds. It would fall into some
    phase-locked pattern that could be "tuned" by adding instructions.

    The snippet I posted using RCtime would be poised to respond
    immediately to the leading edge of the pulse. Everything is faster
    on a BS2SX or BS2P, with enough time to insert an "adjustment"
    instruction.

    ' for BS2SX
    x var word
    loop:
    RCtime 0,0,x ' wait for P0 to go high, and
    ' will delay about 90 microseconds here
    pulsout 2,25 ' this adds another 110 microseconds
    ' with a dummy pulse on P2 (adjustable!)
    pulsout 1,1250 ' output a 1 millisecond pulse on P1
    ' when this pulse finishes
    ' P0 will probably already be low
    ' but just to be sure, we do the following:
    RCtime 0,1,x ' wait for P0 to go low
    goto loop

    Alternatively, the BS2P has the "interrupt" capability, that causes
    an output to change in response to an input without program
    intervention. But I think the latency would depend on what the
    program is doing--The "interupt" response only happens between
    instructions.

    -- best regards
    Tracy Allen
    electronically monitored ecosystems
    http://www.emesystems.com
    mailto:tracy@e...



    >
    >>
    Original Message
    >> From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=guxmTvy9eqGvaa0TLFOk1nMUCsmxEmxfcz8-fnYp-73xi6TiaE6P6sGeFPqz8SveQahIrU9U5wIA5NK0sg]tracy@e...[/url
    >> Sent: Friday, August 31, 2001 11:07 AM
    >> To: basicstamps@yahoogroups.com
    >> Subject: Re: [noparse][[/noparse]basicstamps] BS2 phase shift, signal delay
    >>
    >>
    >> > >From an external source I have a 12 volt square wave signal (20% duty
    >> >cycle at 200Hz).
    >> >
    >> >I would like to input this singal ino a BS2 and ouput the same signal
    >> >with a 200 microsecond delay. (Approx. 15% phase shift).
    >> >
    >> >Any suggestions or comments would be appreciated.
    >>
    >> Why use a BASIC Stamp? Would a simple delay circuit using a couple
    >> of 555 timers or RC delays work okay? If you need exact control over
    >> the delay, and if the output signal has to be an exact copy of the
    >> input signal, then you will need a much faster micro. The Stamp is
    >> not so good for that, because each single Stamp instruction takes
    >> about 200 microseconds.
    >>
    >> That said, you could get near a 200 microsecond delay by having the
    >> stamp delay one instruction:
    >>
    >
    > > x var word
    >> loop:
    >> RCtime 0,0,x ' wait for P0 to go high
    >> ' will delay about 220 microseconds here
    >> pulsout 1,500 ' output a 1 millisecond pulse on P1
    >> RCtime 0,1,x ' wait for P0 to go low
    >> goto loop
    > >
    >> The RCtime instructions above are only used to await a change in pin
    >> state. One millisecond is 20% duty cycle of a 200hz signal.
    >>
    >> -- regards,
    >> Tracy Allen
    >> electronically monitored ecosystems
    >> mailto:tracy@e...
    > > http://www.emesystems.com
    >>
    >>
    >> 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/
Sign In or Register to comment.