Shop OBEX P1 Docs P2 Docs Learn Events
How to pause or wait for 40 microsecond or more — Parallax Forums

How to pause or wait for 40 microsecond or more

ArchiverArchiver Posts: 46,084
edited 2003-03-28 00:52 in General Discussion
Hi all,
I am looking for a pulse on pin 1 of a BS2 stamp module and once that
pulse arrives need to wait a given amount of time (from
40microseconds to a few millisecond, user defined) before setting
another pin high. I tried to setup a counter loop but even the first
count takes too long to execute. Is there some way to do this by
looking at the internal clock or is there a function that counts in
microsecond resolution?
Thanks
-Salman

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-03-27 21:52
    In a message dated 3/27/2003 1:05:06 PM Pacific Standard Time,
    snematic@y... writes:

    > Hi all,
    > I am looking for a pulse on pin 1 of a BS2 stamp module and once that
    > pulse arrives need to wait a given amount of time (from
    > 40microseconds to a few millisecond, user defined) before setting
    > another pin high. I tried to setup a counter loop but even the first
    > count takes too long to execute. Is there some way to do this by
    > looking at the internal clock or is there a function that counts in
    > microsecond resolution?
    > Thanks
    > -Salman

    I don't think 40 us delay is possible with the BS2. You may try the
    following....

    Connect a scope to an output pin. Make the output pin high, do some
    instruction to waste time, then make the same output pin go low and measure
    that pulse.

    Browsing the manual, the shortest nap instruction is 1ms.

    An alternative is to go to the SX chip (not the BS2SX). If you are doing
    simple I/O and are not using alot of the user friendly stamp commands than
    the SX is the way to go. Running the SX at 50 Mhz, one instruction takes 20
    nS, making your 40us and eternity and an easy to deal with number for the SX.


    Parallax sells this SX. The learing curve for the SX is harder than the BS2.
    There are advantages to both however.
    Ken


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-27 22:27
    You can use de PULSOUT command:

    PULSOUT pin, period

    where the period unit is 2us when using BS2. So, if you want a 40us
    positive pulse at pin 1, then

    INPUT 1
    PULSOUT 1, 20

    The max. pulse width is near 130 ms.

    4L.


    Mensaje original
    De: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=6NdsHeFst7zXnADfNk6jm7vz-4gTqbke5pm6odWy5QNjnORXhMNLq90g0k9ItOBO1ZSWMHBjXx4y]smartdim@a...[/url
    Enviado el: jueves, 27 de marzo de 2003 22:53
    Para: basicstamps@yahoogroups.com
    Asunto: Re: [noparse][[/noparse]basicstamps] How to pause or wait for 40 microsecond or
    more


    In a message dated 3/27/2003 1:05:06 PM Pacific Standard Time,
    snematic@y... writes:

    > Hi all,
    > I am looking for a pulse on pin 1 of a BS2 stamp module and once that
    > pulse arrives need to wait a given amount of time (from
    > 40microseconds to a few millisecond, user defined) before setting
    > another pin high. I tried to setup a counter loop but even the first
    > count takes too long to execute. Is there some way to do this by
    > looking at the internal clock or is there a function that counts in
    > microsecond resolution?
    > Thanks
    > -Salman

    I don't think 40 us delay is possible with the BS2. You may try the
    following....

    Connect a scope to an output pin. Make the output pin high, do some
    instruction to waste time, then make the same output pin go low and measure
    that pulse.

    Browsing the manual, the shortest nap instruction is 1ms.

    An alternative is to go to the SX chip (not the BS2SX). If you are doing
    simple I/O and are not using alot of the user friendly stamp commands than
    the SX is the way to go. Running the SX at 50 Mhz, one instruction takes 20
    nS, making your 40us and eternity and an easy to deal with number for the
    SX.


    Parallax sells this SX. The learing curve for the SX is harder than the BS2.
    There are advantages to both however.
    Ken


    [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 2003-03-27 22:27
    The BS2SX does 12,000 Instructions per second which still wouldnt be
    fast enough for a 40microsecond delay assuming I setup a for loop as
    a means to waste time.
    -Salman
    --- In basicstamps@yahoogroups.com, smartdim@a... wrote:
    > In a message dated 3/27/2003 1:05:06 PM Pacific Standard Time,
    > snematic@y... writes:
    >
    > > Hi all,
    > > I am looking for a pulse on pin 1 of a BS2 stamp module and once
    that
    > > pulse arrives need to wait a given amount of time (from
    > > 40microseconds to a few millisecond, user defined) before setting
    > > another pin high. I tried to setup a counter loop but even the
    first
    > > count takes too long to execute. Is there some way to do this by
    > > looking at the internal clock or is there a function that counts
    in
    > > microsecond resolution?
    > > Thanks
    > > -Salman
    >
    > I don't think 40 us delay is possible with the BS2. You may try
    the
    > following....
    >
    > Connect a scope to an output pin. Make the output pin high, do some
    > instruction to waste time, then make the same output pin go low and
    measure
    > that pulse.
    >
    > Browsing the manual, the shortest nap instruction is 1ms.
    >
    > An alternative is to go to the SX chip (not the BS2SX). If you are
    doing
    > simple I/O and are not using alot of the user friendly stamp
    commands than
    > the SX is the way to go. Running the SX at 50 Mhz, one instruction
    takes 20
    > nS, making your 40us and eternity and an easy to deal with number
    for the SX.
    >
    >
    > Parallax sells this SX. The learing curve for the SX is harder than
    the BS2.
    > There are advantages to both however.
    > Ken
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-27 23:00
    Hi Salman,
    have a look at:
    Timing tables for various commands
    on:
    http://www.emesystems.com/BS2speed.htm

    the shortest command is 41microsecond (high1)on the Bs2P
    May be You could use the high or low command on a not used pin
    to get a short pause....? but still longer then 40microsecond
    and in an loop much longer

    good luck Heinz




    Original Message
    From: "snematic" <snematic@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Thursday, March 27, 2003 10:03 PM
    Subject: [noparse][[/noparse]basicstamps] How to pause or wait for 40 microsecond or more


    > Hi all,
    > I am looking for a pulse on pin 1 of a BS2 stamp module and once that
    > pulse arrives need to wait a given amount of time (from
    > 40microseconds to a few millisecond, user defined) before setting
    > another pin high. I tried to setup a counter loop but even the first
    > count takes too long to execute. Is there some way to do this by
    > looking at the internal clock or is there a function that counts in
    > microsecond resolution?
    > Thanks
    > -Salman
    >
    >
    > 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 2003-03-27 23:19
    Hi 4L,
    as far as I understand:
    the pulsout command make the pin high for 2us
    but I believe that the whole command needs much longer
    and too long for Salman

    Correct me if I am wrong
    I had some similar problems before and could not solve it
    with the pulsout command

    Heinz



    > You can use de PULSOUT command:
    >
    > PULSOUT pin, period
    >
    > where the period unit is 2us when using BS2. So, if you want a 40us
    > positive pulse at pin 1, then
    >
    > INPUT 1
    > PULSOUT 1, 20
    >
    > The max. pulse width is near 130 ms.
    >
    > 4L.
    >
    >
    >
    Mensaje original
    > De: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=H1Mqajfzal074w1r0C9Xq50Xll3IBgoeqd8PYeU4n1bpQ2-tjtC-uNlkvs7Qybdx3xnd20ryesm65A]smartdim@a...[/url
    > Enviado el: jueves, 27 de marzo de 2003 22:53
    > Para: basicstamps@yahoogroups.com
    > Asunto: Re: [noparse][[/noparse]basicstamps] How to pause or wait for 40 microsecond or
    > more
    >
    >
    > In a message dated 3/27/2003 1:05:06 PM Pacific Standard Time,
    > snematic@y... writes:
    >
    > > Hi all,
    > > I am looking for a pulse on pin 1 of a BS2 stamp module and once that
    > > pulse arrives need to wait a given amount of time (from
    > > 40microseconds to a few millisecond, user defined) before setting
    > > another pin high. I tried to setup a counter loop but even the first
    > > count takes too long to execute. Is there some way to do this by
    > > looking at the internal clock or is there a function that counts in
    > > microsecond resolution?
    > > Thanks
    > > -Salman
    >
    > I don't think 40 us delay is possible with the BS2. You may try the
    > following....
    >
    > Connect a scope to an output pin. Make the output pin high, do some
    > instruction to waste time, then make the same output pin go low and
    measure
    > that pulse.
    >
    > Browsing the manual, the shortest nap instruction is 1ms.
    >
    > An alternative is to go to the SX chip (not the BS2SX). If you are doing
    > simple I/O and are not using alot of the user friendly stamp commands than
    > the SX is the way to go. Running the SX at 50 Mhz, one instruction takes
    20
    > nS, making your 40us and eternity and an easy to deal with number for the
    > SX.
    >
    >
    > Parallax sells this SX. The learing curve for the SX is harder than the
    BS2.
    > There are advantages to both however.
    > Ken
    >
    >
    > [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 2003-03-28 00:52
    Hi Heinz.
    I was wrong, it was a bad reading. Sorry.

    The BS? takes too long with read access to EEPROM for the interpreter,
    to allow such resolutions between commands.

    4L.


    Mensaje original
    De: HSchwenk_GMX [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=p6cL3G0hH-ulFHZnlDBtYdTIfFBfUZ_Swg4LmRj0QFOEmyrQqHyOb9wzf-h2jQpfaLzZasPPFgY]hschwenk@g...[/url
    Enviado el: viernes, 28 de marzo de 2003 00:20
    Para: basicstamps@yahoogroups.com
    Asunto: Re: [noparse][[/noparse]basicstamps] How to pause or wait for 40 microsecond or
    more


    Hi 4L,
    as far as I understand:
    the pulsout command make the pin high for 2us
    but I believe that the whole command needs much longer
    and too long for Salman

    Correct me if I am wrong
    I had some similar problems before and could not solve it
    with the pulsout command

    Heinz



    > You can use de PULSOUT command:
    >
    > PULSOUT pin, period
    >
    > where the period unit is 2us when using BS2. So, if you want a 40us
    > positive pulse at pin 1, then
    >
    > INPUT 1
    > PULSOUT 1, 20
    >
    > The max. pulse width is near 130 ms.
    >
    > 4L.
    >
    >
    >
    Mensaje original
    > De: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=XW-xLspKRwweuKWdixWUyajXW8n9snOkzFOMksqlVY6ZVU43rhdxugMB4CLKY5iXWrkMLUpNTg]smartdim@a...[/url
    > Enviado el: jueves, 27 de marzo de 2003 22:53
    > Para: basicstamps@yahoogroups.com
    > Asunto: Re: [noparse][[/noparse]basicstamps] How to pause or wait for 40 microsecond or
    > more
    >
    >
    > In a message dated 3/27/2003 1:05:06 PM Pacific Standard Time,
    > snematic@y... writes:
    >
    > > Hi all,
    > > I am looking for a pulse on pin 1 of a BS2 stamp module and once that
    > > pulse arrives need to wait a given amount of time (from
    > > 40microseconds to a few millisecond, user defined) before setting
    > > another pin high. I tried to setup a counter loop but even the first
    > > count takes too long to execute. Is there some way to do this by
    > > looking at the internal clock or is there a function that counts in
    > > microsecond resolution?
    > > Thanks
    > > -Salman
    >
    > I don't think 40 us delay is possible with the BS2. You may try the
    > following....
    >
    > Connect a scope to an output pin. Make the output pin high, do some
    > instruction to waste time, then make the same output pin go low and
    measure
    > that pulse.
    >
    > Browsing the manual, the shortest nap instruction is 1ms.
    >
    > An alternative is to go to the SX chip (not the BS2SX). If you are doing
    > simple I/O and are not using alot of the user friendly stamp commands than
    > the SX is the way to go. Running the SX at 50 Mhz, one instruction takes
    20
    > nS, making your 40us and eternity and an easy to deal with number for the
    > SX.
    >
    >
    > Parallax sells this SX. The learing curve for the SX is harder than the
    BS2.
    > There are advantages to both however.
    > Ken
    >
    >
    > [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/
    >
    >


    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.