Shop OBEX P1 Docs P2 Docs Learn Events
Pause For Microsec — Parallax Forums

Pause For Microsec

ArchiverArchiver Posts: 46,084
edited 2002-12-20 06:53 in General Discussion
Hi Every1,

I'm using BS2 for my school project. As my project is based on a time
critical application, I need to have time delays in terms of
microseconds.

Luckily, there's a "PAUSE" command for all BS but this command can
only support for miliseconds. I even tried to do like this just to
get a delay of 500 mircosec "PAUSE 0.5" but it is not acceptable by
the Editor. :-(

Is there any other way where I can use other commands that can
support microseconds?

Yes, I have tried "PULSOUT" (can support microsec) but it can only
produce a pulse not a time delay that i wanted.

Thanks,
PCTSP

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 17:22
    Remember, you're working with an interpreter, not a compiler -- so getting a
    PAUSE lower than 1 ms is just plain tough. That said, you can do a PAUSE 0
    which will give you about 100 microseconds. That's about the best we can do
    with the BASIC Stamp.

    If you really need that much precision, you could switch to assembly and use
    the SX directly ... that will give you complete control. Tougher to write
    code though.

    -- Jon Williams
    -- Parallax


    In a message dated 12/19/2002 11:16:31 AM Central Standard Time,
    pctsp@y... writes:

    > Hi Every1,
    >
    > I'm using BS2 for my school project. As my project is based on a time
    > critical application, I need to have time delays in terms of
    > microseconds.
    >
    > Luckily, there's a "PAUSE" command for all BS but this command can
    > only support for miliseconds. I even tried to do like this just to
    > get a delay of 500 mircosec "PAUSE 0.5" but it is not acceptable by
    > the Editor. :-(
    >
    > Is there any other way where I can use other commands that can
    > support microseconds?
    >
    > Yes, I have tried "PULSOUT" (can support microsec) but it can only
    > produce a pulse not a time delay that i wanted.
    >
    > Thanks,
    > PCTSP



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 17:33
    > If you really need that much precision, you could switch to assembly and
    use
    > the SX directly ... that will give you complete control. Tougher to write
    > code though.

    Is there some kind of PBasic firmware on the Stamp you need to overwrite to
    do this, or can you simply download Assembly?

    Robert
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 17:37
    Thanks for the advice. In that case, I may need to use a hard-core
    micro-controller and program like a assembly freak.. Oh boy, can't
    use BS...:-(



    --- In basicstamps@yahoogroups.com, jonwms@a... wrote:
    > Remember, you're working with an interpreter, not a compiler -- so
    getting a
    > PAUSE lower than 1 ms is just plain tough. That said, you can do a
    PAUSE 0
    > which will give you about 100 microseconds. That's about the best
    we can do
    > with the BASIC Stamp.
    >
    > If you really need that much precision, you could switch to
    assembly and use
    > the SX directly ... that will give you complete control. Tougher
    to write
    > code though.
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    > In a message dated 12/19/2002 11:16:31 AM Central Standard Time,
    > pctsp@y... writes:
    >
    > > Hi Every1,
    > >
    > > I'm using BS2 for my school project. As my project is based on a
    time
    > > critical application, I need to have time delays in terms of
    > > microseconds.
    > >
    > > Luckily, there's a "PAUSE" command for all BS but this command
    can
    > > only support for miliseconds. I even tried to do like this just
    to
    > > get a delay of 500 mircosec "PAUSE 0.5" but it is not acceptable
    by
    > > the Editor. :-(
    > >
    > > Is there any other way where I can use other commands that can
    > > support microseconds?
    > >
    > > Yes, I have tried "PULSOUT" (can support microsec) but it can
    only
    > > produce a pulse not a time delay that i wanted.
    > >
    > > Thanks,
    > > PCTSP
    >
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 18:14
    Use an O-scope to see how long it takes to waste time with an instruction
    like making a pin high then immeadiately low.

    ie...put an oscope on pin 0 for example. then send the commands to make pin 0
    high then low. Measure the time of the high pulse. Based on this time to go
    high then low, you can stack up several commands to get close to the delay
    time you want.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 18:34
    You would have to write in assembly for the SX (or PIC or AVR, etc.) -- you
    cannot reprogram the Stamp interpreter.

    -- Jon Williams
    -- Parallax

    In a message dated 12/19/2002 11:39:21 AM Central Standard Time,
    uavscience@f... writes:

    > Is there some kind of PBasic firmware on the Stamp you need to overwrite to
    > do this, or can you simply download Assembly?



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 18:36
    You might want to look into SXWiz (BASIC compiler for SX micros). We've
    heard that it works well and is farily easy to use -- and has short delays
    like what you need.

    -- Jon Williams
    -- Parallax


    In a message dated 12/19/2002 11:40:54 AM Central Standard Time,
    pctsp@y... writes:

    > Thanks for the advice. In that case, I may need to use a hard-core
    > micro-controller and program like a assembly freak.. Oh boy, can't
    > use BS...:-(



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 18:53
    You can use a programmable or fixed delay line. No need to use a
    different architecture, just some added hardware. Maxim has a
    selection of programmable and fixed delay lines.

    http://para.maximic.com/compare.aspFam=ProgDel&Tree=Timers&HP=Timers.c
    fm&ln=


    Jason
    --- In basicstamps@yahoogroups.com, jonwms@a... wrote:
    > You might want to look into SXWiz (BASIC compiler for SX micros).
    We've
    > heard that it works well and is farily easy to use -- and has short
    delays
    > like what you need.
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    > In a message dated 12/19/2002 11:40:54 AM Central Standard Time,
    > pctsp@y... writes:
    >
    > > Thanks for the advice. In that case, I may need to use a hard-
    core
    > > micro-controller and program like a assembly freak.. Oh boy,
    can't
    > > use BS...:-(
    >
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 19:07
    Hey
    How dose one acquire the Sxwiz. . That would mean that it is not
    nesesary to buy
    Micro labs Pic Basic Pro. Any comments ?
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-19 23:33
    Hi,

    You could use just a plain old PIC. Cheap to write code, cheap to program,
    especially if you need such accurate timing critically. If you're
    programming in assembly (which is not that difficult) you don't need Pic
    basic or any tools other than what Microchip provides for free.

    The programming hardware, if you don't want to make it urself, should be
    able to be had for less than US$40, and programming software is free
    depending on which PIC you choose.

    With a 20MHz crystal a PIC can give you up to 200ns resolution using the
    noop command.

    HTH.
    Mos.

    --
    84 AE86, 90 ST185GrpA, 91 MX83Gr, Sydney, Oz.

    On Thu, 19 Dec 2002, Lawrence C. Windrem wrote:

    > Hey
    > How dose one acquire the Sxwiz. . That would mean that it is not
    > nesesary to buy
    > Micro labs Pic Basic Pro. Any comments ?
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-20 06:08
    Hi,

    Where do i get info abt Sxwiz? Am I able to get it from Parrllax?

    PCTSP
    --- In basicstamps@yahoogroups.com, Mos <mos@s...> wrote:
    > Hi,
    >
    > You could use just a plain old PIC. Cheap to write code, cheap to
    program,
    > especially if you need such accurate timing critically. If you're
    > programming in assembly (which is not that difficult) you don't
    need Pic
    > basic or any tools other than what Microchip provides for free.
    >
    > The programming hardware, if you don't want to make it urself,
    should be
    > able to be had for less than US$40, and programming software is free
    > depending on which PIC you choose.
    >
    > With a 20MHz crystal a PIC can give you up to 200ns resolution
    using the
    > noop command.
    >
    > HTH.
    > Mos.
    >
    > --
    > 84 AE86, 90 ST185GrpA, 91 MX83Gr, Sydney, Oz.
    >
    > On Thu, 19 Dec 2002, Lawrence C. Windrem wrote:
    >
    > > Hey
    > > How dose one acquire the Sxwiz. . That would mean that it is
    not
    > > nesesary to buy
    > > Micro labs Pic Basic Pro. Any comments ?
  • ArchiverArchiver Posts: 46,084
    edited 2002-12-20 06:53
    It is not a Parallax product. Check it out at <A
    HREF="www.sxwiz.com">www.sxwiz.com</A>.

    -- Jon Williams
    -- Parallax


    In a message dated 12/20/2002 12:10:52 AM Central Standard Time,
    pctsp@y... writes:

    > Where do i get info abt Sxwiz? Am I able to get it from Parrllax?
    >



    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.